mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-14 05:58:13 +08:00
修复mico-sdk错误
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
; *************************************************************
|
||||
; *** Scatter-Loading Description File generated by uVision ***
|
||||
; *************************************************************
|
||||
|
||||
LR_IROM1 0x08000000 0x00008000 {
|
||||
ER_IROM1 0x08000000 0x00008000
|
||||
{
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
startup_stm32f4xx_bootloader_RVMDK.o
|
||||
}
|
||||
ER_IROM2 0x20000000 0x00008000 {
|
||||
.ANY (+RO)
|
||||
}
|
||||
RW_IRAM1 0x20008000 0x00012000
|
||||
{
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
}
|
||||
|
||||
; *************************************************************
|
||||
; *** Scatter-Loading Description File generated by uVision ***
|
||||
; *************************************************************
|
||||
|
||||
LR_IROM1 0x08000000 0x00008000 {
|
||||
ER_IROM1 0x08000000 0x00008000
|
||||
{
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
startup_stm32f4xx_bootloader_RVMDK.o
|
||||
}
|
||||
ER_IROM2 0x20000000 0x00008000 {
|
||||
.ANY (+RO)
|
||||
}
|
||||
RW_IRAM1 0x20008000 0x00012000
|
||||
{
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
0
mico-os/board/MK3288/flash_prog.elf
Executable file → Normal file
0
mico-os/board/MK3288/flash_prog.elf
Executable file → Normal file
@@ -1,31 +1,31 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright (c) 2016 MXCHIP Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K
|
||||
APP_FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 1000K
|
||||
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright (c) 2016 MXCHIP Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K
|
||||
APP_FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 1000K
|
||||
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
}
|
||||
@@ -1,30 +1,30 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x08008000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x0800C000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x2001FFFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x200;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x14500;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite,
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x08008000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x0800C000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x2001FFFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x200;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x14500;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite,
|
||||
block CSTACK, block HEAP };
|
||||
@@ -1,476 +1,476 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform.c
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-May-2014
|
||||
* @brief This file provides all MICO Peripherals mapping table and platform
|
||||
* specific functions.
|
||||
******************************************************************************
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright (c) 2014 MXCHIP Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "mico_platform.h"
|
||||
#include "platform.h"
|
||||
#include "platform_config.h"
|
||||
#include "platform_peripheral.h"
|
||||
#include "platform_config.h"
|
||||
#include "platform_logging.h"
|
||||
#include "spi_flash_platform_interface.h"
|
||||
#include "wlan_platform_common.h"
|
||||
#include "CheckSumUtils.h"
|
||||
#include "keypad/gpio_button/button.h"
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
#include "MiCOKit_EXT/micokit_ext.h"
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
extern WEAK void PlatformEasyLinkButtonClickedCallback(void);
|
||||
extern WEAK void PlatformStandbyButtonClickedCallback(void);
|
||||
extern WEAK void PlatformEasyLinkButtonLongPressedCallback(void);
|
||||
|
||||
/******************************************************
|
||||
* Variables Definitions
|
||||
******************************************************/
|
||||
|
||||
const platform_gpio_t platform_gpio_pins[] =
|
||||
{
|
||||
/* GPIOs for external use */
|
||||
[MICO_GPIO_4] = { GPIOA, 15 },
|
||||
[MICO_GPIO_5] = { GPIOB, 3 },
|
||||
[MICO_GPIO_6] = { GPIOA, 11 },
|
||||
[MICO_GPIO_7] = { GPIOB, 4 },
|
||||
[MICO_GPIO_9] = { GPIOA, 4 },
|
||||
[MICO_GPIO_10] = { GPIOB, 8 },
|
||||
[MICO_GPIO_11] = { GPIOB, 9 },
|
||||
[MICO_GPIO_14] = { GPIOC, 13 },
|
||||
[MICO_GPIO_21] = { GPIOA, 2 }, //UART1_TX_DEBUG
|
||||
[MICO_GPIO_22] = { GPIOA, 3 }, //UART1_RX_DEBUG
|
||||
[MICO_GPIO_23] = { GPIOA, 0 }, //EasyLink_BUTTON
|
||||
[MICO_GPIO_24] = { GPIOA, 1 },
|
||||
[MICO_GPIO_25] = { GPIOB, 0 }, //spi_flash_spi_pins
|
||||
[MICO_GPIO_26] = { GPIOB, 1 }, //spi_flash_spi_pins
|
||||
[MICO_GPIO_27] = { GPIOA, 12 }, //spi_flash_spi_pins
|
||||
[MICO_GPIO_28] = { GPIOA, 10 }, //spi_flash_spi_pins
|
||||
[MICO_GPIO_29] = { GPIOA, 5 },
|
||||
[MICO_GPIO_30] = { GPIOB, 2 }, //BOOT
|
||||
[MICO_GPIO_31] = { GPIOA, 7 },
|
||||
[MICO_GPIO_32] = { GPIOB, 12 }, //MICO_SYS_LED
|
||||
[MICO_GPIO_33] = { GPIOB, 13 }, //MFG
|
||||
};
|
||||
|
||||
const platform_pwm_t *platform_pwm_peripherals = NULL;
|
||||
|
||||
const platform_i2c_t platform_i2c_peripherals[] =
|
||||
{
|
||||
[MICO_I2C_1] =
|
||||
{
|
||||
.port = I2C1,
|
||||
.pin_scl = &platform_gpio_pins[MICO_GPIO_10],
|
||||
.pin_sda = &platform_gpio_pins[MICO_GPIO_11],
|
||||
.peripheral_clock_reg = RCC_APB1Periph_I2C1,
|
||||
.tx_dma = DMA1,
|
||||
.tx_dma_peripheral_clock = RCC_AHB1Periph_DMA1,
|
||||
.tx_dma_stream = DMA1_Stream7,
|
||||
.rx_dma_stream = DMA1_Stream5,
|
||||
.tx_dma_stream_id = 7,
|
||||
.rx_dma_stream_id = 5,
|
||||
.tx_dma_channel = DMA_Channel_1,
|
||||
.rx_dma_channel = DMA_Channel_1,
|
||||
.gpio_af_scl = GPIO_AF_I2C2,
|
||||
.gpio_af_sda = GPIO_AF_I2C2
|
||||
},
|
||||
};
|
||||
|
||||
platform_i2c_driver_t platform_i2c_drivers[MICO_I2C_MAX];
|
||||
|
||||
const platform_uart_t platform_uart_peripherals[] =
|
||||
{
|
||||
[MICO_UART_1] =
|
||||
{
|
||||
.port = USART2,
|
||||
.pin_tx = &platform_gpio_pins[MICO_GPIO_21],
|
||||
.pin_rx = &platform_gpio_pins[MICO_GPIO_22],
|
||||
.pin_cts = NULL,
|
||||
.pin_rts = NULL,
|
||||
.tx_dma_config =
|
||||
{
|
||||
.controller = DMA1,
|
||||
.stream = DMA1_Stream6,
|
||||
.channel = DMA_Channel_4,
|
||||
.irq_vector = DMA1_Stream6_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF6,
|
||||
.error_flags = ( DMA_HISR_TEIF6 | DMA_HISR_FEIF6 ),
|
||||
},
|
||||
.rx_dma_config =
|
||||
{
|
||||
.controller = DMA1,
|
||||
.stream = DMA1_Stream5,
|
||||
.channel = DMA_Channel_4,
|
||||
.irq_vector = DMA1_Stream5_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF5,
|
||||
.error_flags = ( DMA_HISR_TEIF5 | DMA_HISR_FEIF5 | DMA_HISR_DMEIF5 ),
|
||||
},
|
||||
},
|
||||
[MICO_UART_2] =
|
||||
{
|
||||
.port = USART1,
|
||||
.pin_tx = &platform_gpio_pins[Arduino_TXD],
|
||||
.pin_rx = &platform_gpio_pins[Arduino_RXD],
|
||||
.pin_cts = NULL,
|
||||
.pin_rts = NULL,
|
||||
.tx_dma_config =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream7,
|
||||
.channel = DMA_Channel_4,
|
||||
.irq_vector = DMA2_Stream7_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF7,
|
||||
.error_flags = ( DMA_HISR_TEIF7 | DMA_HISR_FEIF7 ),
|
||||
},
|
||||
.rx_dma_config =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream2,
|
||||
.channel = DMA_Channel_4,
|
||||
.irq_vector = DMA2_Stream2_IRQn,
|
||||
.complete_flags = DMA_LISR_TCIF2,
|
||||
.error_flags = ( DMA_LISR_TEIF2 | DMA_LISR_FEIF2 | DMA_LISR_DMEIF2 ),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
platform_uart_driver_t platform_uart_drivers[MICO_UART_MAX];
|
||||
|
||||
const platform_spi_t platform_spi_peripherals[] =
|
||||
{
|
||||
[MICO_SPI_1] =
|
||||
{
|
||||
.port = SPI5,
|
||||
.gpio_af = GPIO_AF6_SPI5,
|
||||
.peripheral_clock_reg = RCC_APB2Periph_SPI5,
|
||||
.peripheral_clock_func = RCC_APB2PeriphClockCmd,
|
||||
.pin_mosi = &platform_gpio_pins[MICO_GPIO_28],
|
||||
.pin_miso = &platform_gpio_pins[MICO_GPIO_27],
|
||||
.pin_clock = &platform_gpio_pins[MICO_GPIO_25],
|
||||
.tx_dma =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream6,
|
||||
.channel = DMA_Channel_7,
|
||||
.irq_vector = DMA2_Stream6_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF6,
|
||||
.error_flags = ( DMA_HISR_TEIF6 | DMA_HISR_FEIF6 ),
|
||||
},
|
||||
.rx_dma =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream5,
|
||||
.channel = DMA_Channel_7,
|
||||
.irq_vector = DMA2_Stream5_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF5,
|
||||
.error_flags = ( DMA_HISR_TEIF5 | DMA_HISR_FEIF5 | DMA_HISR_DMEIF5 ),
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
platform_spi_driver_t platform_spi_drivers[MICO_SPI_MAX];
|
||||
|
||||
#if defined ( USE_MICO_SPI_FLASH )
|
||||
const mico_spi_device_t mico_spi_flash =
|
||||
{
|
||||
.port = MICO_SPI_1,
|
||||
.chip_select = MICO_GPIO_26,
|
||||
.speed = 40000000,
|
||||
.mode = (SPI_CLOCK_RISING_EDGE | SPI_CLOCK_IDLE_HIGH | SPI_USE_DMA | SPI_MSB_FIRST),
|
||||
.bits = 8
|
||||
};
|
||||
#endif
|
||||
|
||||
const platform_adc_t platform_adc_peripherals[] =
|
||||
{
|
||||
[MICO_ADC_1] = { ADC1, ADC_Channel_4, RCC_APB2Periph_ADC1, 1, (platform_gpio_t*)&platform_gpio_pins[MICO_GPIO_9] },
|
||||
[MICO_ADC_2] = { ADC1, ADC_Channel_1, RCC_APB2Periph_ADC1, 1, (platform_gpio_t*)&platform_gpio_pins[MICO_GPIO_24] },
|
||||
};
|
||||
|
||||
/* Wi-Fi control pins. Used by platform/MCU/wlan_platform_common.c
|
||||
*/
|
||||
const platform_gpio_t wifi_control_pins[] =
|
||||
{
|
||||
[WIFI_PIN_POWER ] = { GPIOB, 6 },
|
||||
};
|
||||
|
||||
/* Wi-Fi SDIO bus pins. Used by platform/MCU/STM32F2xx/EMW1062_driver/wlan_SDIO.c */
|
||||
const platform_gpio_t wifi_sdio_pins[] =
|
||||
{
|
||||
#ifdef SDIO_1_BIT
|
||||
[WIFI_PIN_SDIO_IRQ ] = { GPIOA, 8 },
|
||||
#endif
|
||||
[WIFI_PIN_SDIO_CLK ] = { GPIOB, 15 },
|
||||
[WIFI_PIN_SDIO_CMD ] = { GPIOA, 6 },
|
||||
[WIFI_PIN_SDIO_D0 ] = { GPIOB, 7 },
|
||||
#ifndef SDIO_1_BIT
|
||||
[WIFI_PIN_SDIO_D1 ] = { GPIOA, 8 },
|
||||
[WIFI_PIN_SDIO_D2 ] = { GPIOA, 9 },
|
||||
[WIFI_PIN_SDIO_D3 ] = { GPIOB, 5 },
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Flash memory devices */
|
||||
const platform_flash_t platform_flash_peripherals[] =
|
||||
{
|
||||
[MICO_FLASH_EMBEDDED] =
|
||||
{
|
||||
.flash_type = FLASH_TYPE_EMBEDDED,
|
||||
.flash_start_addr = 0x08000000,
|
||||
.flash_length = 0x80000,
|
||||
},
|
||||
[MICO_FLASH_SPI] =
|
||||
{
|
||||
.flash_type = FLASH_TYPE_SPI,
|
||||
.flash_start_addr = 0x000000,
|
||||
.flash_length = 0x200000,
|
||||
},
|
||||
};
|
||||
|
||||
platform_flash_driver_t platform_flash_drivers[MICO_FLASH_MAX];
|
||||
|
||||
/* Logic partition on flash devices */
|
||||
const mico_logic_partition_t mico_partitions[] =
|
||||
{
|
||||
[MICO_PARTITION_BOOTLOADER] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_EMBEDDED,
|
||||
.partition_description = "Bootloader",
|
||||
.partition_start_addr = 0x08000000,
|
||||
.partition_length = 0x8000, //32k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_DIS,
|
||||
},
|
||||
[MICO_PARTITION_APPLICATION] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_EMBEDDED,
|
||||
.partition_description = "Application",
|
||||
.partition_start_addr = 0x08008000,
|
||||
.partition_length = 0x78000, //480k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_DIS,
|
||||
},
|
||||
[MICO_PARTITION_RF_FIRMWARE] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "RF Firmware",
|
||||
.partition_start_addr = 0x2000,
|
||||
.partition_length = 0x4E000, //312k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_DIS,
|
||||
},
|
||||
[MICO_PARTITION_OTA_TEMP] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "OTA Storage",
|
||||
.partition_start_addr = 0x50000,
|
||||
.partition_length = 0x74000, //768k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[MICO_PARTITION_PARAMETER_1] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "PARAMETER1",
|
||||
.partition_start_addr = 0x0,
|
||||
.partition_length = 0x1000, // 4k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[MICO_PARTITION_PARAMETER_2] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "PARAMETER2",
|
||||
.partition_start_addr = 0x1000,
|
||||
.partition_length = 0x1000, //4k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************
|
||||
* Interrupt Handler Definitions
|
||||
******************************************************/
|
||||
|
||||
/* USART2 -> MICO_UART_1 */
|
||||
MICO_RTOS_DEFINE_ISR( USART2_IRQHandler )
|
||||
{
|
||||
platform_uart_irq( &platform_uart_drivers[MICO_UART_1] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( DMA1_Stream6_IRQHandler )
|
||||
{
|
||||
platform_uart_tx_dma_irq( &platform_uart_drivers[MICO_UART_1] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( DMA1_Stream5_IRQHandler )
|
||||
{
|
||||
platform_uart_rx_dma_irq( &platform_uart_drivers[MICO_UART_1] );
|
||||
}
|
||||
|
||||
/* USART1 -> MICO_UART_2 */
|
||||
MICO_RTOS_DEFINE_ISR( USART1_IRQHandler )
|
||||
{
|
||||
platform_uart_irq( &platform_uart_drivers[MICO_UART_2] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( DMA2_Stream7_IRQHandler )
|
||||
{
|
||||
platform_uart_tx_dma_irq( &platform_uart_drivers[MICO_UART_2] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( DMA2_Stream2_IRQHandler )
|
||||
{
|
||||
platform_uart_rx_dma_irq( &platform_uart_drivers[MICO_UART_2] );
|
||||
}
|
||||
|
||||
void platform_init_peripheral_irq_priorities( void )
|
||||
{
|
||||
/* Interrupt priority setup. Called by MiCO/platform/MCU/STM32F2xx/platform_init.c */
|
||||
NVIC_SetPriority( RTC_WKUP_IRQn , 1 ); /* RTC Wake-up event */
|
||||
NVIC_SetPriority( SDIO_IRQn , 2 ); /* WLAN SDIO */
|
||||
NVIC_SetPriority( DMA2_Stream3_IRQn, 3 ); /* WLAN SDIO DMA */
|
||||
NVIC_SetPriority( USART1_IRQn , 6 ); /* MICO_UART_1 */
|
||||
// NVIC_SetPriority( USART2_IRQn , 6 ); /* MICO_UART_2 */
|
||||
NVIC_SetPriority( DMA1_Stream6_IRQn, 7 ); /* MICO_UART_1 TX DMA */
|
||||
NVIC_SetPriority( DMA1_Stream5_IRQn, 7 ); /* MICO_UART_1 RX DMA */
|
||||
// NVIC_SetPriority( DMA2_Stream7_IRQn, 7 ); /* MICO_UART_2 TX DMA */
|
||||
// NVIC_SetPriority( DMA2_Stream2_IRQn, 7 ); /* MICO_UART_2 RX DMA */
|
||||
NVIC_SetPriority( EXTI0_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI1_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI2_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI3_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI4_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI9_5_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI15_10_IRQn , 14 ); /* GPIO */
|
||||
}
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Function Definitions
|
||||
******************************************************/
|
||||
|
||||
void init_platform( void )
|
||||
{
|
||||
button_init_t init;
|
||||
|
||||
MicoGpioInitialize( (mico_gpio_t) MICO_SYS_LED, OUTPUT_PUSH_PULL );
|
||||
MicoGpioOutputLow( (mico_gpio_t) MICO_SYS_LED );
|
||||
MicoGpioInitialize( (mico_gpio_t) MICO_RF_LED, OUTPUT_OPEN_DRAIN_NO_PULL );
|
||||
MicoGpioOutputHigh( (mico_gpio_t) MICO_RF_LED );
|
||||
|
||||
// Initialise EasyLink buttons
|
||||
init.gpio = EasyLink_BUTTON;
|
||||
init.pressed_func = PlatformEasyLinkButtonClickedCallback;
|
||||
init.long_pressed_func = PlatformEasyLinkButtonLongPressedCallback;
|
||||
init.long_pressed_timeout = RestoreDefault_TimeOut;
|
||||
|
||||
button_init( IOBUTTON_EASYLINK, init );
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
dc_motor_init( );
|
||||
dc_motor_set( 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
void init_platform_bootloader( void )
|
||||
{
|
||||
MicoGpioInitialize( (mico_gpio_t)MICO_SYS_LED, OUTPUT_PUSH_PULL );
|
||||
MicoGpioOutputLow( (mico_gpio_t)MICO_SYS_LED );
|
||||
MicoGpioInitialize( (mico_gpio_t)MICO_RF_LED, OUTPUT_OPEN_DRAIN_NO_PULL );
|
||||
MicoGpioOutputHigh( (mico_gpio_t)MICO_RF_LED );
|
||||
|
||||
MicoGpioInitialize((mico_gpio_t)BOOT_SEL, INPUT_PULL_UP);
|
||||
MicoGpioInitialize((mico_gpio_t)MFG_SEL, INPUT_HIGH_IMPEDANCE);
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
dc_motor_init( );
|
||||
dc_motor_set( 0 );
|
||||
|
||||
rgb_led_init();
|
||||
rgb_led_open(0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MicoSysLed(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
MicoGpioOutputLow( (mico_gpio_t)MICO_SYS_LED );
|
||||
} else {
|
||||
MicoGpioOutputHigh( (mico_gpio_t)MICO_SYS_LED );
|
||||
}
|
||||
}
|
||||
|
||||
// Only one led on base board, so use system led as RF led.
|
||||
void MicoRfLed(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
MicoSysLed(true);
|
||||
} else {
|
||||
MicoSysLed(false);
|
||||
}
|
||||
}
|
||||
|
||||
// add long press key2 on ext-board when restart to enter MFG MODE
|
||||
bool MicoShouldEnterMFGMode(void)
|
||||
{
|
||||
if( MicoGpioInputGet((mico_gpio_t)BOOT_SEL)==false && MicoGpioInputGet((mico_gpio_t)MFG_SEL)==false )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// bootloader mode: SW1=ON, SW2=OFF
|
||||
bool MicoShouldEnterBootloader(void)
|
||||
{
|
||||
if(MicoGpioInputGet((mico_gpio_t)BOOT_SEL)==false && MicoGpioInputGet((mico_gpio_t)MFG_SEL)==true)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform.c
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-May-2014
|
||||
* @brief This file provides all MICO Peripherals mapping table and platform
|
||||
* specific functions.
|
||||
******************************************************************************
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright (c) 2014 MXCHIP Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "mico_platform.h"
|
||||
#include "platform.h"
|
||||
#include "platform_config.h"
|
||||
#include "platform_peripheral.h"
|
||||
#include "platform_config.h"
|
||||
#include "platform_logging.h"
|
||||
#include "spi_flash_platform_interface.h"
|
||||
#include "wlan_platform_common.h"
|
||||
#include "CheckSumUtils.h"
|
||||
#include "keypad/gpio_button/button.h"
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
#include "MiCOKit_EXT/micokit_ext.h"
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
extern WEAK void PlatformEasyLinkButtonClickedCallback(void);
|
||||
extern WEAK void PlatformStandbyButtonClickedCallback(void);
|
||||
extern WEAK void PlatformEasyLinkButtonLongPressedCallback(void);
|
||||
|
||||
/******************************************************
|
||||
* Variables Definitions
|
||||
******************************************************/
|
||||
|
||||
const platform_gpio_t platform_gpio_pins[] =
|
||||
{
|
||||
/* GPIOs for external use */
|
||||
[MICO_GPIO_4] = { GPIOA, 15 },
|
||||
[MICO_GPIO_5] = { GPIOB, 3 },
|
||||
[MICO_GPIO_6] = { GPIOA, 11 },
|
||||
[MICO_GPIO_7] = { GPIOB, 4 },
|
||||
[MICO_GPIO_9] = { GPIOA, 4 },
|
||||
[MICO_GPIO_10] = { GPIOB, 8 },
|
||||
[MICO_GPIO_11] = { GPIOB, 9 },
|
||||
[MICO_GPIO_14] = { GPIOC, 13 },
|
||||
[MICO_GPIO_21] = { GPIOA, 2 }, //UART1_TX_DEBUG
|
||||
[MICO_GPIO_22] = { GPIOA, 3 }, //UART1_RX_DEBUG
|
||||
[MICO_GPIO_23] = { GPIOA, 0 }, //EasyLink_BUTTON
|
||||
[MICO_GPIO_24] = { GPIOA, 1 },
|
||||
[MICO_GPIO_25] = { GPIOB, 0 }, //spi_flash_spi_pins
|
||||
[MICO_GPIO_26] = { GPIOB, 1 }, //spi_flash_spi_pins
|
||||
[MICO_GPIO_27] = { GPIOA, 12 }, //spi_flash_spi_pins
|
||||
[MICO_GPIO_28] = { GPIOA, 10 }, //spi_flash_spi_pins
|
||||
[MICO_GPIO_29] = { GPIOA, 5 },
|
||||
[MICO_GPIO_30] = { GPIOB, 2 }, //BOOT
|
||||
[MICO_GPIO_31] = { GPIOA, 7 },
|
||||
[MICO_GPIO_32] = { GPIOB, 12 }, //MICO_SYS_LED
|
||||
[MICO_GPIO_33] = { GPIOB, 13 }, //MFG
|
||||
};
|
||||
|
||||
const platform_pwm_t *platform_pwm_peripherals = NULL;
|
||||
|
||||
const platform_i2c_t platform_i2c_peripherals[] =
|
||||
{
|
||||
[MICO_I2C_1] =
|
||||
{
|
||||
.port = I2C1,
|
||||
.pin_scl = &platform_gpio_pins[MICO_GPIO_10],
|
||||
.pin_sda = &platform_gpio_pins[MICO_GPIO_11],
|
||||
.peripheral_clock_reg = RCC_APB1Periph_I2C1,
|
||||
.tx_dma = DMA1,
|
||||
.tx_dma_peripheral_clock = RCC_AHB1Periph_DMA1,
|
||||
.tx_dma_stream = DMA1_Stream7,
|
||||
.rx_dma_stream = DMA1_Stream5,
|
||||
.tx_dma_stream_id = 7,
|
||||
.rx_dma_stream_id = 5,
|
||||
.tx_dma_channel = DMA_Channel_1,
|
||||
.rx_dma_channel = DMA_Channel_1,
|
||||
.gpio_af_scl = GPIO_AF_I2C2,
|
||||
.gpio_af_sda = GPIO_AF_I2C2
|
||||
},
|
||||
};
|
||||
|
||||
platform_i2c_driver_t platform_i2c_drivers[MICO_I2C_MAX];
|
||||
|
||||
const platform_uart_t platform_uart_peripherals[] =
|
||||
{
|
||||
[MICO_UART_1] =
|
||||
{
|
||||
.port = USART2,
|
||||
.pin_tx = &platform_gpio_pins[MICO_GPIO_21],
|
||||
.pin_rx = &platform_gpio_pins[MICO_GPIO_22],
|
||||
.pin_cts = NULL,
|
||||
.pin_rts = NULL,
|
||||
.tx_dma_config =
|
||||
{
|
||||
.controller = DMA1,
|
||||
.stream = DMA1_Stream6,
|
||||
.channel = DMA_Channel_4,
|
||||
.irq_vector = DMA1_Stream6_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF6,
|
||||
.error_flags = ( DMA_HISR_TEIF6 | DMA_HISR_FEIF6 ),
|
||||
},
|
||||
.rx_dma_config =
|
||||
{
|
||||
.controller = DMA1,
|
||||
.stream = DMA1_Stream5,
|
||||
.channel = DMA_Channel_4,
|
||||
.irq_vector = DMA1_Stream5_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF5,
|
||||
.error_flags = ( DMA_HISR_TEIF5 | DMA_HISR_FEIF5 | DMA_HISR_DMEIF5 ),
|
||||
},
|
||||
},
|
||||
[MICO_UART_2] =
|
||||
{
|
||||
.port = USART1,
|
||||
.pin_tx = &platform_gpio_pins[Arduino_TXD],
|
||||
.pin_rx = &platform_gpio_pins[Arduino_RXD],
|
||||
.pin_cts = NULL,
|
||||
.pin_rts = NULL,
|
||||
.tx_dma_config =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream7,
|
||||
.channel = DMA_Channel_4,
|
||||
.irq_vector = DMA2_Stream7_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF7,
|
||||
.error_flags = ( DMA_HISR_TEIF7 | DMA_HISR_FEIF7 ),
|
||||
},
|
||||
.rx_dma_config =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream2,
|
||||
.channel = DMA_Channel_4,
|
||||
.irq_vector = DMA2_Stream2_IRQn,
|
||||
.complete_flags = DMA_LISR_TCIF2,
|
||||
.error_flags = ( DMA_LISR_TEIF2 | DMA_LISR_FEIF2 | DMA_LISR_DMEIF2 ),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
platform_uart_driver_t platform_uart_drivers[MICO_UART_MAX];
|
||||
|
||||
const platform_spi_t platform_spi_peripherals[] =
|
||||
{
|
||||
[MICO_SPI_1] =
|
||||
{
|
||||
.port = SPI5,
|
||||
.gpio_af = GPIO_AF6_SPI5,
|
||||
.peripheral_clock_reg = RCC_APB2Periph_SPI5,
|
||||
.peripheral_clock_func = RCC_APB2PeriphClockCmd,
|
||||
.pin_mosi = &platform_gpio_pins[MICO_GPIO_28],
|
||||
.pin_miso = &platform_gpio_pins[MICO_GPIO_27],
|
||||
.pin_clock = &platform_gpio_pins[MICO_GPIO_25],
|
||||
.tx_dma =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream6,
|
||||
.channel = DMA_Channel_7,
|
||||
.irq_vector = DMA2_Stream6_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF6,
|
||||
.error_flags = ( DMA_HISR_TEIF6 | DMA_HISR_FEIF6 ),
|
||||
},
|
||||
.rx_dma =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream5,
|
||||
.channel = DMA_Channel_7,
|
||||
.irq_vector = DMA2_Stream5_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF5,
|
||||
.error_flags = ( DMA_HISR_TEIF5 | DMA_HISR_FEIF5 | DMA_HISR_DMEIF5 ),
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
platform_spi_driver_t platform_spi_drivers[MICO_SPI_MAX];
|
||||
|
||||
#if defined ( USE_MICO_SPI_FLASH )
|
||||
const mico_spi_device_t mico_spi_flash =
|
||||
{
|
||||
.port = MICO_SPI_1,
|
||||
.chip_select = MICO_GPIO_26,
|
||||
.speed = 40000000,
|
||||
.mode = (SPI_CLOCK_RISING_EDGE | SPI_CLOCK_IDLE_HIGH | SPI_USE_DMA | SPI_MSB_FIRST),
|
||||
.bits = 8
|
||||
};
|
||||
#endif
|
||||
|
||||
const platform_adc_t platform_adc_peripherals[] =
|
||||
{
|
||||
[MICO_ADC_1] = { ADC1, ADC_Channel_4, RCC_APB2Periph_ADC1, 1, (platform_gpio_t*)&platform_gpio_pins[MICO_GPIO_9] },
|
||||
[MICO_ADC_2] = { ADC1, ADC_Channel_1, RCC_APB2Periph_ADC1, 1, (platform_gpio_t*)&platform_gpio_pins[MICO_GPIO_24] },
|
||||
};
|
||||
|
||||
/* Wi-Fi control pins. Used by platform/MCU/wlan_platform_common.c
|
||||
*/
|
||||
const platform_gpio_t wifi_control_pins[] =
|
||||
{
|
||||
[WIFI_PIN_POWER ] = { GPIOB, 6 },
|
||||
};
|
||||
|
||||
/* Wi-Fi SDIO bus pins. Used by platform/MCU/STM32F2xx/EMW1062_driver/wlan_SDIO.c */
|
||||
const platform_gpio_t wifi_sdio_pins[] =
|
||||
{
|
||||
#ifdef SDIO_1_BIT
|
||||
[WIFI_PIN_SDIO_IRQ ] = { GPIOA, 8 },
|
||||
#endif
|
||||
[WIFI_PIN_SDIO_CLK ] = { GPIOB, 15 },
|
||||
[WIFI_PIN_SDIO_CMD ] = { GPIOA, 6 },
|
||||
[WIFI_PIN_SDIO_D0 ] = { GPIOB, 7 },
|
||||
#ifndef SDIO_1_BIT
|
||||
[WIFI_PIN_SDIO_D1 ] = { GPIOA, 8 },
|
||||
[WIFI_PIN_SDIO_D2 ] = { GPIOA, 9 },
|
||||
[WIFI_PIN_SDIO_D3 ] = { GPIOB, 5 },
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Flash memory devices */
|
||||
const platform_flash_t platform_flash_peripherals[] =
|
||||
{
|
||||
[MICO_FLASH_EMBEDDED] =
|
||||
{
|
||||
.flash_type = FLASH_TYPE_EMBEDDED,
|
||||
.flash_start_addr = 0x08000000,
|
||||
.flash_length = 0x80000,
|
||||
},
|
||||
[MICO_FLASH_SPI] =
|
||||
{
|
||||
.flash_type = FLASH_TYPE_SPI,
|
||||
.flash_start_addr = 0x000000,
|
||||
.flash_length = 0x200000,
|
||||
},
|
||||
};
|
||||
|
||||
platform_flash_driver_t platform_flash_drivers[MICO_FLASH_MAX];
|
||||
|
||||
/* Logic partition on flash devices */
|
||||
const mico_logic_partition_t mico_partitions[] =
|
||||
{
|
||||
[MICO_PARTITION_BOOTLOADER] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_EMBEDDED,
|
||||
.partition_description = "Bootloader",
|
||||
.partition_start_addr = 0x08000000,
|
||||
.partition_length = 0x8000, //32k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_DIS,
|
||||
},
|
||||
[MICO_PARTITION_APPLICATION] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_EMBEDDED,
|
||||
.partition_description = "Application",
|
||||
.partition_start_addr = 0x08008000,
|
||||
.partition_length = 0x78000, //480k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_DIS,
|
||||
},
|
||||
[MICO_PARTITION_RF_FIRMWARE] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "RF Firmware",
|
||||
.partition_start_addr = 0x2000,
|
||||
.partition_length = 0x4E000, //312k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_DIS,
|
||||
},
|
||||
[MICO_PARTITION_OTA_TEMP] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "OTA Storage",
|
||||
.partition_start_addr = 0x50000,
|
||||
.partition_length = 0x74000, //768k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[MICO_PARTITION_PARAMETER_1] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "PARAMETER1",
|
||||
.partition_start_addr = 0x0,
|
||||
.partition_length = 0x1000, // 4k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[MICO_PARTITION_PARAMETER_2] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "PARAMETER2",
|
||||
.partition_start_addr = 0x1000,
|
||||
.partition_length = 0x1000, //4k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************
|
||||
* Interrupt Handler Definitions
|
||||
******************************************************/
|
||||
|
||||
/* USART2 -> MICO_UART_1 */
|
||||
MICO_RTOS_DEFINE_ISR( USART2_IRQHandler )
|
||||
{
|
||||
platform_uart_irq( &platform_uart_drivers[MICO_UART_1] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( DMA1_Stream6_IRQHandler )
|
||||
{
|
||||
platform_uart_tx_dma_irq( &platform_uart_drivers[MICO_UART_1] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( DMA1_Stream5_IRQHandler )
|
||||
{
|
||||
platform_uart_rx_dma_irq( &platform_uart_drivers[MICO_UART_1] );
|
||||
}
|
||||
|
||||
/* USART1 -> MICO_UART_2 */
|
||||
MICO_RTOS_DEFINE_ISR( USART1_IRQHandler )
|
||||
{
|
||||
platform_uart_irq( &platform_uart_drivers[MICO_UART_2] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( DMA2_Stream7_IRQHandler )
|
||||
{
|
||||
platform_uart_tx_dma_irq( &platform_uart_drivers[MICO_UART_2] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( DMA2_Stream2_IRQHandler )
|
||||
{
|
||||
platform_uart_rx_dma_irq( &platform_uart_drivers[MICO_UART_2] );
|
||||
}
|
||||
|
||||
void platform_init_peripheral_irq_priorities( void )
|
||||
{
|
||||
/* Interrupt priority setup. Called by MiCO/platform/MCU/STM32F2xx/platform_init.c */
|
||||
NVIC_SetPriority( RTC_WKUP_IRQn , 1 ); /* RTC Wake-up event */
|
||||
NVIC_SetPriority( SDIO_IRQn , 2 ); /* WLAN SDIO */
|
||||
NVIC_SetPriority( DMA2_Stream3_IRQn, 3 ); /* WLAN SDIO DMA */
|
||||
NVIC_SetPriority( USART1_IRQn , 6 ); /* MICO_UART_1 */
|
||||
// NVIC_SetPriority( USART2_IRQn , 6 ); /* MICO_UART_2 */
|
||||
NVIC_SetPriority( DMA1_Stream6_IRQn, 7 ); /* MICO_UART_1 TX DMA */
|
||||
NVIC_SetPriority( DMA1_Stream5_IRQn, 7 ); /* MICO_UART_1 RX DMA */
|
||||
// NVIC_SetPriority( DMA2_Stream7_IRQn, 7 ); /* MICO_UART_2 TX DMA */
|
||||
// NVIC_SetPriority( DMA2_Stream2_IRQn, 7 ); /* MICO_UART_2 RX DMA */
|
||||
NVIC_SetPriority( EXTI0_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI1_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI2_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI3_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI4_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI9_5_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI15_10_IRQn , 14 ); /* GPIO */
|
||||
}
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Function Definitions
|
||||
******************************************************/
|
||||
|
||||
void init_platform( void )
|
||||
{
|
||||
button_init_t init;
|
||||
|
||||
MicoGpioInitialize( (mico_gpio_t) MICO_SYS_LED, OUTPUT_PUSH_PULL );
|
||||
MicoGpioOutputLow( (mico_gpio_t) MICO_SYS_LED );
|
||||
MicoGpioInitialize( (mico_gpio_t) MICO_RF_LED, OUTPUT_OPEN_DRAIN_NO_PULL );
|
||||
MicoGpioOutputHigh( (mico_gpio_t) MICO_RF_LED );
|
||||
|
||||
// Initialise EasyLink buttons
|
||||
init.gpio = EasyLink_BUTTON;
|
||||
init.pressed_func = PlatformEasyLinkButtonClickedCallback;
|
||||
init.long_pressed_func = PlatformEasyLinkButtonLongPressedCallback;
|
||||
init.long_pressed_timeout = RestoreDefault_TimeOut;
|
||||
|
||||
button_init( IOBUTTON_EASYLINK, init );
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
dc_motor_init( );
|
||||
dc_motor_set( 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
void init_platform_bootloader( void )
|
||||
{
|
||||
MicoGpioInitialize( (mico_gpio_t)MICO_SYS_LED, OUTPUT_PUSH_PULL );
|
||||
MicoGpioOutputLow( (mico_gpio_t)MICO_SYS_LED );
|
||||
MicoGpioInitialize( (mico_gpio_t)MICO_RF_LED, OUTPUT_OPEN_DRAIN_NO_PULL );
|
||||
MicoGpioOutputHigh( (mico_gpio_t)MICO_RF_LED );
|
||||
|
||||
MicoGpioInitialize((mico_gpio_t)BOOT_SEL, INPUT_PULL_UP);
|
||||
MicoGpioInitialize((mico_gpio_t)MFG_SEL, INPUT_HIGH_IMPEDANCE);
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
dc_motor_init( );
|
||||
dc_motor_set( 0 );
|
||||
|
||||
rgb_led_init();
|
||||
rgb_led_open(0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MicoSysLed(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
MicoGpioOutputLow( (mico_gpio_t)MICO_SYS_LED );
|
||||
} else {
|
||||
MicoGpioOutputHigh( (mico_gpio_t)MICO_SYS_LED );
|
||||
}
|
||||
}
|
||||
|
||||
// Only one led on base board, so use system led as RF led.
|
||||
void MicoRfLed(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
MicoSysLed(true);
|
||||
} else {
|
||||
MicoSysLed(false);
|
||||
}
|
||||
}
|
||||
|
||||
// add long press key2 on ext-board when restart to enter MFG MODE
|
||||
bool MicoShouldEnterMFGMode(void)
|
||||
{
|
||||
if( MicoGpioInputGet((mico_gpio_t)BOOT_SEL)==false && MicoGpioInputGet((mico_gpio_t)MFG_SEL)==false )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// bootloader mode: SW1=ON, SW2=OFF
|
||||
bool MicoShouldEnterBootloader(void)
|
||||
{
|
||||
if(MicoGpioInputGet((mico_gpio_t)BOOT_SEL)==false && MicoGpioInputGet((mico_gpio_t)MFG_SEL)==true)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,201 +1,207 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform.h
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-May-2014
|
||||
* @brief This file provides all MICO Peripherals defined for current platform.
|
||||
******************************************************************************
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright (c) 2014 MXCHIP Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_GPIO_4,
|
||||
MICO_GPIO_5,
|
||||
MICO_GPIO_6,
|
||||
MICO_GPIO_7,
|
||||
MICO_GPIO_9,
|
||||
MICO_GPIO_10,
|
||||
MICO_GPIO_11,
|
||||
MICO_GPIO_14,
|
||||
MICO_GPIO_21,
|
||||
MICO_GPIO_22,
|
||||
MICO_GPIO_23,
|
||||
MICO_GPIO_24,
|
||||
MICO_GPIO_25,
|
||||
MICO_GPIO_26,
|
||||
MICO_GPIO_27,
|
||||
MICO_GPIO_28,
|
||||
MICO_GPIO_29,
|
||||
MICO_GPIO_30,
|
||||
MICO_GPIO_31,
|
||||
MICO_GPIO_32,
|
||||
MICO_GPIO_33,
|
||||
MICO_GPIO_MAX, /* Denotes the total number of GPIO port aliases. Not a valid GPIO alias */
|
||||
MICO_GPIO_NONE,
|
||||
} mico_gpio_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_SPI_1,
|
||||
MICO_SPI_MAX, /* Denotes the total number of SPI port aliases. Not a valid SPI alias */
|
||||
MICO_SPI_NONE,
|
||||
} mico_spi_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_I2C_1,
|
||||
MICO_I2C_MAX, /* Denotes the total number of I2C port aliases. Not a valid I2C alias */
|
||||
MICO_I2C_NONE,
|
||||
} mico_i2c_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_PWM_R,
|
||||
MICO_PWM_G,
|
||||
MICO_PWM_B,
|
||||
MICO_PWM_MAX, /* Denotes the total number of PWM port aliases. Not a valid PWM alias */
|
||||
MICO_PWM_NONE,
|
||||
} mico_pwm_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_ADC_1,
|
||||
MICO_ADC_2,
|
||||
MICO_ADC_3,
|
||||
MICO_ADC_MAX, /* Denotes the total number of ADC port aliases. Not a valid ADC alias */
|
||||
MICO_ADC_NONE,
|
||||
} mico_adc_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_UART_1,
|
||||
MICO_UART_2,
|
||||
MICO_UART_MAX, /* Denotes the total number of UART port aliases. Not a valid UART alias */
|
||||
MICO_UART_NONE,
|
||||
} mico_uart_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_FLASH_EMBEDDED,
|
||||
MICO_FLASH_SPI,
|
||||
MICO_FLASH_MAX,
|
||||
MICO_FLASH_NONE,
|
||||
} mico_flash_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_PARTITION_USER_MAX
|
||||
} mico_user_partition_t;
|
||||
|
||||
#define USE_MICO_SPI_FLASH
|
||||
//#define SFLASH_SUPPORT_MACRONIX_PARTS
|
||||
//#define SFLASH_SUPPORT_SST_PARTS
|
||||
//#define SFLASH_SUPPORT_WINBOND_PARTS
|
||||
|
||||
#ifdef BOOTLOADER
|
||||
#define STDIO_UART MICO_UART_1
|
||||
#define STDIO_UART_BAUDRATE (921600)
|
||||
#else
|
||||
#define STDIO_UART MICO_UART_1
|
||||
#define STDIO_UART_BAUDRATE (115200)
|
||||
#endif
|
||||
|
||||
#define UART_FOR_APP MICO_UART_2
|
||||
#define MFG_TEST MICO_UART_1
|
||||
#define CLI_UART MICO_UART_1
|
||||
|
||||
/* I/O connection <-> Peripheral Connections */
|
||||
/* Mother board connection */
|
||||
#define BOOT_SEL (MICO_GPIO_30)
|
||||
#define MFG_SEL (MICO_GPIO_33)
|
||||
#define MICO_SYS_LED (MICO_GPIO_32)
|
||||
#define MICO_RF_LED (MICO_GPIO_NONE)
|
||||
#define EasyLink_BUTTON (MICO_GPIO_23)
|
||||
|
||||
/* Arduino extention connector */
|
||||
#define Arduino_RXD (MICO_GPIO_5)
|
||||
#define Arduino_TXD (MICO_GPIO_4)
|
||||
#define Arduino_D2 (MICO_GPIO_5)
|
||||
#define Arduino_D3 (MICO_GPIO_4)
|
||||
#define Arduino_D4 (MICO_GPIO_31)
|
||||
#define Arduino_D5 (MICO_GPIO_29)
|
||||
#define Arduino_D6 (MICO_GPIO_24)
|
||||
#define Arduino_D7 (MICO_GPIO_NONE)
|
||||
|
||||
#define Arduino_D8 (MICO_GPIO_6)
|
||||
#define Arduino_D9 (MICO_GPIO_7)
|
||||
#define Arduino_CS (MICO_GPIO_14)
|
||||
#define Arduino_SI (MICO_GPIO_28)
|
||||
#define Arduino_SO (MICO_GPIO_27)
|
||||
#define Arduino_SCK (MICO_GPIO_25)
|
||||
#define Arduino_SDA (MICO_GPIO_11)
|
||||
#define Arduino_SCL (MICO_GPIO_10)
|
||||
|
||||
#define Arduino_A0 (MICO_ADC_NONE)
|
||||
#define Arduino_A1 (MICO_ADC_NONE)
|
||||
#define Arduino_A2 (MICO_ADC_1)
|
||||
#define Arduino_A3 (MICO_ADC_2)
|
||||
#define Arduino_A4 (MICO_ADC_NONE)
|
||||
#define Arduino_A5 (MICO_ADC_NONE)
|
||||
|
||||
|
||||
#define Arduino_I2C (MICO_I2C_1)
|
||||
#define Arduino_SPI (MICO_SPI_1)
|
||||
#define Arduino_UART (MICO_UART_2)
|
||||
|
||||
#define USE_RGB_LED_DRIVER_P9813
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
#define MICO_I2C_CP (Arduino_I2C)
|
||||
#include "micokit_ext_def.h"
|
||||
#else
|
||||
#define MICO_I2C_CP (MICO_I2C_NONE)
|
||||
#endif //USE_MiCOKit_EXT
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform.h
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-May-2014
|
||||
* @brief This file provides all MICO Peripherals defined for current platform.
|
||||
******************************************************************************
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright (c) 2014 MXCHIP Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_GPIO_4,
|
||||
MICO_GPIO_5,
|
||||
MICO_GPIO_6,
|
||||
MICO_GPIO_7,
|
||||
MICO_GPIO_9,
|
||||
MICO_GPIO_10,
|
||||
MICO_GPIO_11,
|
||||
MICO_GPIO_14,
|
||||
MICO_GPIO_21,
|
||||
MICO_GPIO_22,
|
||||
MICO_GPIO_23,
|
||||
MICO_GPIO_24,
|
||||
MICO_GPIO_25,
|
||||
MICO_GPIO_26,
|
||||
MICO_GPIO_27,
|
||||
MICO_GPIO_28,
|
||||
MICO_GPIO_29,
|
||||
MICO_GPIO_30,
|
||||
MICO_GPIO_31,
|
||||
MICO_GPIO_32,
|
||||
MICO_GPIO_33,
|
||||
MICO_GPIO_MAX, /* Denotes the total number of GPIO port aliases. Not a valid GPIO alias */
|
||||
MICO_GPIO_NONE,
|
||||
} mico_gpio_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_SPI_1,
|
||||
MICO_SPI_MAX, /* Denotes the total number of SPI port aliases. Not a valid SPI alias */
|
||||
MICO_SPI_NONE,
|
||||
} mico_spi_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_I2C_1,
|
||||
MICO_I2C_MAX, /* Denotes the total number of I2C port aliases. Not a valid I2C alias */
|
||||
MICO_I2C_NONE,
|
||||
} mico_i2c_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_IIS_MAX, /* Denotes the total number of IIS port aliases. Not a valid IIS alias */
|
||||
MICO_IIS_NONE,
|
||||
} mico_iis_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_PWM_R,
|
||||
MICO_PWM_G,
|
||||
MICO_PWM_B,
|
||||
MICO_PWM_MAX, /* Denotes the total number of PWM port aliases. Not a valid PWM alias */
|
||||
MICO_PWM_NONE,
|
||||
} mico_pwm_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_ADC_1,
|
||||
MICO_ADC_2,
|
||||
MICO_ADC_3,
|
||||
MICO_ADC_MAX, /* Denotes the total number of ADC port aliases. Not a valid ADC alias */
|
||||
MICO_ADC_NONE,
|
||||
} mico_adc_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_UART_1,
|
||||
MICO_UART_2,
|
||||
MICO_UART_MAX, /* Denotes the total number of UART port aliases. Not a valid UART alias */
|
||||
MICO_UART_NONE,
|
||||
} mico_uart_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_FLASH_EMBEDDED,
|
||||
MICO_FLASH_SPI,
|
||||
MICO_FLASH_MAX,
|
||||
MICO_FLASH_NONE,
|
||||
} mico_flash_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_PARTITION_USER_MAX
|
||||
} mico_user_partition_t;
|
||||
|
||||
#define USE_MICO_SPI_FLASH
|
||||
//#define SFLASH_SUPPORT_MACRONIX_PARTS
|
||||
//#define SFLASH_SUPPORT_SST_PARTS
|
||||
//#define SFLASH_SUPPORT_WINBOND_PARTS
|
||||
|
||||
#ifdef BOOTLOADER
|
||||
#define STDIO_UART MICO_UART_1
|
||||
#define STDIO_UART_BAUDRATE (921600)
|
||||
#else
|
||||
#define STDIO_UART MICO_UART_1
|
||||
#define STDIO_UART_BAUDRATE (115200)
|
||||
#endif
|
||||
|
||||
#define UART_FOR_APP MICO_UART_2
|
||||
#define MFG_TEST MICO_UART_1
|
||||
#define CLI_UART MICO_UART_1
|
||||
|
||||
/* I/O connection <-> Peripheral Connections */
|
||||
/* Mother board connection */
|
||||
#define BOOT_SEL (MICO_GPIO_30)
|
||||
#define MFG_SEL (MICO_GPIO_33)
|
||||
#define MICO_SYS_LED (MICO_GPIO_32)
|
||||
#define MICO_RF_LED (MICO_GPIO_NONE)
|
||||
#define EasyLink_BUTTON (MICO_GPIO_23)
|
||||
|
||||
/* Arduino extention connector */
|
||||
#define Arduino_RXD (MICO_GPIO_5)
|
||||
#define Arduino_TXD (MICO_GPIO_4)
|
||||
#define Arduino_D2 (MICO_GPIO_5)
|
||||
#define Arduino_D3 (MICO_GPIO_4)
|
||||
#define Arduino_D4 (MICO_GPIO_31)
|
||||
#define Arduino_D5 (MICO_GPIO_29)
|
||||
#define Arduino_D6 (MICO_GPIO_24)
|
||||
#define Arduino_D7 (MICO_GPIO_NONE)
|
||||
|
||||
#define Arduino_D8 (MICO_GPIO_6)
|
||||
#define Arduino_D9 (MICO_GPIO_7)
|
||||
#define Arduino_CS (MICO_GPIO_14)
|
||||
#define Arduino_SI (MICO_GPIO_28)
|
||||
#define Arduino_SO (MICO_GPIO_27)
|
||||
#define Arduino_SCK (MICO_GPIO_25)
|
||||
#define Arduino_SDA (MICO_GPIO_11)
|
||||
#define Arduino_SCL (MICO_GPIO_10)
|
||||
|
||||
#define Arduino_A0 (MICO_ADC_NONE)
|
||||
#define Arduino_A1 (MICO_ADC_NONE)
|
||||
#define Arduino_A2 (MICO_ADC_1)
|
||||
#define Arduino_A3 (MICO_ADC_2)
|
||||
#define Arduino_A4 (MICO_ADC_NONE)
|
||||
#define Arduino_A5 (MICO_ADC_NONE)
|
||||
|
||||
|
||||
#define Arduino_I2C (MICO_I2C_1)
|
||||
#define Arduino_SPI (MICO_SPI_1)
|
||||
#define Arduino_UART (MICO_UART_2)
|
||||
|
||||
#define USE_RGB_LED_DRIVER_P9813
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
#define MICO_I2C_CP (Arduino_I2C)
|
||||
#include "micokit_ext_def.h"
|
||||
#else
|
||||
#define MICO_I2C_CP (MICO_I2C_NONE)
|
||||
#endif //USE_MiCOKit_EXT
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,139 +1,139 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform_config.h
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-May-2014
|
||||
* @brief This file provides common configuration for current platform.
|
||||
******************************************************************************
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright (c) 2014 MXCHIP Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
#define HARDWARE_REVISION "MK3288_1"
|
||||
#define DEFAULT_NAME "MiCOKit 3288"
|
||||
#define MODEL "MiCOKit-3288"
|
||||
|
||||
/* MICO RTOS tick rate in Hz */
|
||||
#define MICO_DEFAULT_TICK_RATE_HZ (1000)
|
||||
|
||||
/************************************************************************
|
||||
* Uncomment to disable watchdog. For debugging only */
|
||||
//#define MICO_DISABLE_WATCHDOG
|
||||
|
||||
/************************************************************************
|
||||
* Uncomment to disable standard IO, i.e. printf(), etc. */
|
||||
//#define MICO_DISABLE_STDIO
|
||||
|
||||
/************************************************************************
|
||||
* Uncomment to disable MCU powersave API functions */
|
||||
#define MICO_DISABLE_MCU_POWERSAVE
|
||||
|
||||
/************************************************************************
|
||||
* Uncomment to enable MCU real time clock */
|
||||
//#define MICO_ENABLE_MCU_RTC
|
||||
|
||||
/************************************************************************
|
||||
* Restore default and start easylink after press down EasyLink button for 3 seconds. */
|
||||
#define RestoreDefault_TimeOut (3000)
|
||||
|
||||
/************************************************************************
|
||||
* Restore default and start easylink after press down EasyLink button for 3 seconds. */
|
||||
#define MCU_CLOCK_HZ (100000000)
|
||||
|
||||
/************************************************************************
|
||||
* How many bits are used in NVIC priority configuration */
|
||||
#define CORTEX_NVIC_PRIO_BITS (4)
|
||||
|
||||
/************************************************************************
|
||||
* Enable write protection to write-disabled embedded flash sectors */
|
||||
//#define MCU_EBANLE_FLASH_PROTECT
|
||||
|
||||
#define HSE_SOURCE RCC_HSE_OFF /* Use external crystal */
|
||||
#define AHB_CLOCK_DIVIDER RCC_SYSCLK_Div1 /* AHB clock = System clock */
|
||||
#define APB1_CLOCK_DIVIDER RCC_HCLK_Div2 /* APB1 clock = AHB clock / 2 */
|
||||
#define APB2_CLOCK_DIVIDER RCC_HCLK_Div1 /* APB2 clock = AHB clock / 1 */
|
||||
#define PLL_SOURCE RCC_PLLSource_HSI /* PLL source = external crystal */
|
||||
#define PLL_M_CONSTANT 16 /* PLLM = 16 */
|
||||
#define PLL_N_CONSTANT 400 /* PLLN = 400 */
|
||||
#define PLL_P_CONSTANT 4 /* PLLP = 4 */
|
||||
#define PPL_Q_CONSTANT 7 /* PLLQ = 7 */
|
||||
#define SYSTEM_CLOCK_SOURCE RCC_SYSCLKSource_PLLCLK /* System clock source = PLL clock */
|
||||
#define SYSTICK_CLOCK_SOURCE SysTick_CLKSource_HCLK /* SysTick clock source = AHB clock */
|
||||
#define INT_FLASH_WAIT_STATE FLASH_Latency_3 /* Internal flash wait state = 3 cycles */
|
||||
|
||||
/******************************************************
|
||||
* EMW1088 Options
|
||||
******************************************************/
|
||||
/* Wi-Fi chip module */
|
||||
#define EMW1088
|
||||
|
||||
/* Wi-Fi power pin is present */
|
||||
#define MICO_USE_WIFI_POWER_PIN
|
||||
|
||||
/* USE SDIO 1bit mode */
|
||||
#define SDIO_1_BIT
|
||||
|
||||
/* Wi-Fi power pin is active high */
|
||||
#define MICO_USE_WIFI_POWER_PIN_ACTIVE_HIGH
|
||||
|
||||
//#define MICO_USE_BUILTIN_RF_DRIVER
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Global Variables
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform_config.h
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-May-2014
|
||||
* @brief This file provides common configuration for current platform.
|
||||
******************************************************************************
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright (c) 2014 MXCHIP Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
#define HARDWARE_REVISION "MK3288_1"
|
||||
#define DEFAULT_NAME "MiCOKit 3288"
|
||||
#define MODEL "MiCOKit-3288"
|
||||
|
||||
/* MICO RTOS tick rate in Hz */
|
||||
#define MICO_DEFAULT_TICK_RATE_HZ (1000)
|
||||
|
||||
/************************************************************************
|
||||
* Uncomment to disable watchdog. For debugging only */
|
||||
//#define MICO_DISABLE_WATCHDOG
|
||||
|
||||
/************************************************************************
|
||||
* Uncomment to disable standard IO, i.e. printf(), etc. */
|
||||
//#define MICO_DISABLE_STDIO
|
||||
|
||||
/************************************************************************
|
||||
* Uncomment to disable MCU powersave API functions */
|
||||
#define MICO_DISABLE_MCU_POWERSAVE
|
||||
|
||||
/************************************************************************
|
||||
* Uncomment to enable MCU real time clock */
|
||||
//#define MICO_ENABLE_MCU_RTC
|
||||
|
||||
/************************************************************************
|
||||
* Restore default and start easylink after press down EasyLink button for 3 seconds. */
|
||||
#define RestoreDefault_TimeOut (3000)
|
||||
|
||||
/************************************************************************
|
||||
* Restore default and start easylink after press down EasyLink button for 3 seconds. */
|
||||
#define MCU_CLOCK_HZ (100000000)
|
||||
|
||||
/************************************************************************
|
||||
* How many bits are used in NVIC priority configuration */
|
||||
#define CORTEX_NVIC_PRIO_BITS (4)
|
||||
|
||||
/************************************************************************
|
||||
* Enable write protection to write-disabled embedded flash sectors */
|
||||
//#define MCU_EBANLE_FLASH_PROTECT
|
||||
|
||||
#define HSE_SOURCE RCC_HSE_OFF /* Use external crystal */
|
||||
#define AHB_CLOCK_DIVIDER RCC_SYSCLK_Div1 /* AHB clock = System clock */
|
||||
#define APB1_CLOCK_DIVIDER RCC_HCLK_Div2 /* APB1 clock = AHB clock / 2 */
|
||||
#define APB2_CLOCK_DIVIDER RCC_HCLK_Div1 /* APB2 clock = AHB clock / 1 */
|
||||
#define PLL_SOURCE RCC_PLLSource_HSI /* PLL source = external crystal */
|
||||
#define PLL_M_CONSTANT 16 /* PLLM = 16 */
|
||||
#define PLL_N_CONSTANT 400 /* PLLN = 400 */
|
||||
#define PLL_P_CONSTANT 4 /* PLLP = 4 */
|
||||
#define PPL_Q_CONSTANT 7 /* PLLQ = 7 */
|
||||
#define SYSTEM_CLOCK_SOURCE RCC_SYSCLKSource_PLLCLK /* System clock source = PLL clock */
|
||||
#define SYSTICK_CLOCK_SOURCE SysTick_CLKSource_HCLK /* SysTick clock source = AHB clock */
|
||||
#define INT_FLASH_WAIT_STATE FLASH_Latency_3 /* Internal flash wait state = 3 cycles */
|
||||
|
||||
/******************************************************
|
||||
* EMW1088 Options
|
||||
******************************************************/
|
||||
/* Wi-Fi chip module */
|
||||
#define EMW1088
|
||||
|
||||
/* Wi-Fi power pin is present */
|
||||
#define MICO_USE_WIFI_POWER_PIN
|
||||
|
||||
/* USE SDIO 1bit mode */
|
||||
#define SDIO_1_BIT
|
||||
|
||||
/* Wi-Fi power pin is active high */
|
||||
#define MICO_USE_WIFI_POWER_PIN_ACTIVE_HIGH
|
||||
|
||||
//#define MICO_USE_BUILTIN_RF_DRIVER
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Global Variables
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user