mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-14 05:58:13 +08:00
修复mico-sdk错误
This commit is contained in:
0
mico-os/board/EMW3081/bootloaderLinkerForIAR.icf
Executable file → Normal file
0
mico-os/board/EMW3081/bootloaderLinkerForIAR.icf
Executable file → Normal file
0
mico-os/board/EMW3081/build_info.h
Executable file → Normal file
0
mico-os/board/EMW3081/build_info.h
Executable file → Normal file
0
mico-os/board/EMW3081/fw_loader_main.c
Executable file → Normal file
0
mico-os/board/EMW3081/fw_loader_main.c
Executable file → Normal file
@@ -1,241 +1,241 @@
|
||||
/*###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__ = 0x00000000;
|
||||
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x000FFFFF;
|
||||
define symbol __ICFEDIT_region_TCM_start__ = 0x1FFF0000;
|
||||
define symbol __ICFEDIT_region_TCM_end__ = 0x1FFFFFFF;
|
||||
define symbol __ICFEDIT_region_ROM_USED_RAM_start__ = 0x10000000;
|
||||
define symbol __ICFEDIT_region_ROM_USED_RAM_end__ = 0x10005FFF;
|
||||
define symbol __ICFEDIT_region_FWLOADER_start__ = 0x10006000;
|
||||
define symbol __ICFEDIT_region_FWLOADER_end__ = 0x1000DFFF;
|
||||
//define symbol __ICFEDIT_region_RECY_RAM_start__ = 0x10002090;
|
||||
//define symbol __ICFEDIT_region_RECY_RAM_end__ = 0x100037FF;
|
||||
define symbol __ICFEDIT_region_BD_RAM_start__ = 0x1000E000;
|
||||
define symbol __ICFEDIT_region_BD_RAM_end__ = 0x1006FFFF;
|
||||
define symbol __ICFEDIT_region_SDRAM_RAM_start__ = 0x30000000;
|
||||
define symbol __ICFEDIT_region_SDRAM_RAM_end__ = 0x301FFFFF;
|
||||
|
||||
/*-Sizes-*/
|
||||
/*define symbol __ICFEDIT_size_cstack__ = 0x400;*/
|
||||
/*define symbol __ICFEDIT_size_heap__ = 0x800;*/
|
||||
/**** 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 TCM_region = mem:[from __ICFEDIT_region_TCM_start__ to __ICFEDIT_region_TCM_end__];
|
||||
define region ROM_USED_RAM_region = mem:[from __ICFEDIT_region_ROM_USED_RAM_start__ to __ICFEDIT_region_ROM_USED_RAM_end__];
|
||||
//define region RECY_RAM_region = mem:[from __ICFEDIT_region_RECY_RAM_start__ to __ICFEDIT_region_RECY_RAM_end__];
|
||||
define region FWLOADER_region = mem:[from __ICFEDIT_region_FWLOADER_start__ to __ICFEDIT_region_FWLOADER_end__];
|
||||
define region BD_RAM_region = mem:[from __ICFEDIT_region_BD_RAM_start__ to __ICFEDIT_region_BD_RAM_end__];
|
||||
define region SDRAM_RAM_region = mem:[from __ICFEDIT_region_SDRAM_RAM_start__ to __ICFEDIT_region_SDRAM_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 };
|
||||
//initialize by copy with packing = none { section __DLIB_PERTHREAD }; // Required in a multi-threaded application
|
||||
|
||||
//do not initialize { section * };
|
||||
|
||||
//place at address mem:__ICFEDIT_intvec_start__ { readonly section .vectors_table };
|
||||
|
||||
|
||||
/*place in RAM_region { readwrite, block CSTACK, block HEAP };*/
|
||||
place in TCM_region { readwrite };
|
||||
|
||||
/****************************************
|
||||
* ROM Section config *
|
||||
****************************************/
|
||||
keep { section .rom };
|
||||
place at start of ROM_region { readonly, section .rom };
|
||||
|
||||
/****************************************
|
||||
* BD RAM Section config *
|
||||
****************************************/
|
||||
keep { section .ram_dedecated_vector_table* };
|
||||
define block .vector_table with fixed order{section .ram_dedecated_vector_table*};
|
||||
|
||||
keep { section .ram_user_define_irq_table* };
|
||||
define block .user_vector_table with fixed order{section .ram_user_define_irq_table*};
|
||||
|
||||
keep { section .ram_user_define_data_table* };
|
||||
define block .user_data_table with fixed order{section .ram_user_define_data_table*};
|
||||
|
||||
define block .rom.bss with fixed order{ section .hal.ram.bss* object hal_misc.o,
|
||||
section .hal.ram.bss* object hal_pinmux.o,
|
||||
section .hal.ram.bss* object diag.o,
|
||||
section .hal.ram.bss* object rtl8195a_ssi_rom.o,
|
||||
section .hal.ram.bss* object rtl8195a_gpio.o,
|
||||
section .hal.ram.bss*,
|
||||
section .timer2_7_vector_table.data*,
|
||||
section .infra.ram.bss*,
|
||||
section .mon.ram.bss*,
|
||||
section .wlan_ram_map* object rom_wlan_ram_map.o,
|
||||
section .wlan_ram_map*,
|
||||
section .libc.ram.bss*,
|
||||
};
|
||||
|
||||
keep { section .start.ram.data* };
|
||||
define block .ram.start.table with fixed order{ section .start.ram.data* };
|
||||
|
||||
keep { section .image1.validate.rodata* };
|
||||
keep { section .infra.ram.data* };
|
||||
keep { section .timer.ram.data* };
|
||||
keep { section .hal.ram.data* };
|
||||
define block .ram_image1.data with fixed order{ section .image1.validate.rodata*,
|
||||
section .infra.ram.data*,
|
||||
section .timer.ram.data*,
|
||||
section .cutb.ram.data*,
|
||||
section .hal.ram.data* object rom.o, // for standard libaray __impure_data_ptr
|
||||
section .cutc.ram.data*,
|
||||
section .hal.ram.data*
|
||||
};
|
||||
define block .ram_image1.bss with fixed order{ //section .hal.flash.data*,
|
||||
section .hal.sdrc.data*
|
||||
};
|
||||
|
||||
define block .ram_image1.text with fixed order{ section .hal.ram.text*,
|
||||
section .hal.sdrc.text*,
|
||||
//section .text* object startup.o,
|
||||
section .infra.ram.text*,
|
||||
};
|
||||
|
||||
define block IMAGE1 with fixed order { section LOADER };
|
||||
define block IMAGE1_DBG with fixed order { block .ram.start.table, block .ram_image1.data, block .ram_image1.bss, block .ram_image1.text };
|
||||
|
||||
place at start of ROM_USED_RAM_region { readwrite,
|
||||
block .vector_table,
|
||||
block .user_vector_table,
|
||||
block .user_data_table,
|
||||
block .rom.bss,
|
||||
block IMAGE1
|
||||
};
|
||||
|
||||
keep { section .fwloader.start_ram.data* };
|
||||
define block .fwloader.start.table1 with fixed order{ section .fwloader.start_ram.data* };
|
||||
|
||||
keep { section .fwloader.validate.rodata* };
|
||||
define block .fwloader.start.table2 with fixed order{ section .fwloader.validate.rodata* };
|
||||
|
||||
//keep { section .fwloader.ram.data* };
|
||||
//define block .fwloader_ram.data with fixed order{ section .fwloader.ram.data*,
|
||||
// section .data* object fw_loader_main.o,
|
||||
// section .bss* object fw_loader_main.o,
|
||||
// section .rodata* object fw_loader_main.o
|
||||
// };
|
||||
|
||||
//keep { section .fwloader.ram.start* };
|
||||
//define block .fwloader_ram.text with fixed order{
|
||||
// section .text* object fw_loader_main.o
|
||||
// };
|
||||
|
||||
|
||||
|
||||
define block FWLOADER with fixed order { block .fwloader.start.table1,
|
||||
block .fwloader.start.table2,
|
||||
// block .fwloader_ram.text,
|
||||
// block .fwloader_ram.data
|
||||
};
|
||||
|
||||
place at start of FWLOADER_region { readwrite, block FWLOADER };
|
||||
|
||||
|
||||
|
||||
keep { section .image2.ram.data* };
|
||||
define block .image2.start.table1 with fixed order{ section .image2.ram.data* };
|
||||
|
||||
keep { section .image2.validate.rodata*, section .custom.validate.rodata* };
|
||||
define block .image2.start.table2 with fixed order{ section .image2.validate.rodata*, section .custom.validate.rodata* };
|
||||
|
||||
define block SHT$$PREINIT_ARRAY { preinit_array };
|
||||
define block SHT$$INIT_ARRAY { init_array };
|
||||
define block CPP_INIT with fixed order { block SHT$$PREINIT_ARRAY,
|
||||
block SHT$$INIT_ARRAY };
|
||||
|
||||
define block .ram_image2.text with fixed order{ section .infra.ram.start*,
|
||||
section .rodata*,
|
||||
block CPP_INIT,
|
||||
section .mon.ram.text*,
|
||||
section .hal.flash.text*,
|
||||
section .hal.gpio.text*,
|
||||
section .text*,
|
||||
section CODE,
|
||||
section .otg.rom.text,
|
||||
section Veneer object startup.o,
|
||||
section __DLIB_PERTHREAD,
|
||||
//section .mdns.text
|
||||
};
|
||||
|
||||
define block .ram.data with fixed order{ section .data*,
|
||||
section DATA,
|
||||
section .ram.otg.data.a,
|
||||
section .iar.init_table,
|
||||
//section .mdns.data
|
||||
};
|
||||
|
||||
define block IMAGE2 with fixed order { block .image2.start.table1, block .image2.start.table2, block .ram_image2.text, block .ram.data };
|
||||
|
||||
define block .ram.bss with fixed order{ section .bss*,
|
||||
section .ssl_ram_map,
|
||||
section .hal.flash.data*,
|
||||
section .hal.gpio.data*,
|
||||
section COMMON,
|
||||
section .bdsram.data*,
|
||||
section .bss* object heap_5.o
|
||||
};
|
||||
define block .bf_data with fixed order{ section .bfsram.data* };
|
||||
define block .heap with fixed order{ section .heap* };
|
||||
define block .stack_dummy with fixed order { section .stack };
|
||||
place at start of BD_RAM_region { readwrite,
|
||||
block IMAGE2,
|
||||
//block IMAGE1_DBG,
|
||||
block .ram.bss,
|
||||
//block .bf_data,
|
||||
};
|
||||
|
||||
//place at address mem:0x10052b00 { readwrite,
|
||||
place at end of BD_RAM_region { readwrite,
|
||||
block .bf_data,
|
||||
};
|
||||
|
||||
define block SDRAM with fixed order{ section .sdram.text*,
|
||||
section .sdram.data*,
|
||||
section .mdns.text*,
|
||||
section .mdns.data*,
|
||||
section .text object HomeKit*,
|
||||
section .text object fe_*,
|
||||
section .text object ge_*,
|
||||
section .text object sc_*,
|
||||
section .text object auth_poly1305_donna.o,
|
||||
section .text object sc_muladd.o
|
||||
};
|
||||
place at start of SDRAM_RAM_region { readwrite,
|
||||
block SDRAM,
|
||||
//block IMAGE1_DBG
|
||||
};
|
||||
|
||||
|
||||
/* TCM placement */
|
||||
define overlay TCM_overlay { section .tcm.heap,
|
||||
section .tcm.bss,
|
||||
section .bss object memp.o,
|
||||
block .heap,
|
||||
block .stack_dummy
|
||||
};
|
||||
/* dummy code placement */
|
||||
define overlay TCM_overlay { block IMAGE1_DBG };
|
||||
place at start of TCM_region { readwrite,
|
||||
overlay TCM_overlay
|
||||
};
|
||||
|
||||
define exported symbol __rom_bss_start__ = 0x10000300; // use in rom
|
||||
define exported symbol __rom_bss_end__ = 0x10000bc8; // use in rom
|
||||
define exported symbol __ram_start_table_start__= 0x10000bc8; // use in rom
|
||||
define exported symbol __image1_validate_code__= 0x10000bdc; // needed by ram code
|
||||
define exported symbol _rtl_impure_ptr = 0x10001c60; // for standard library
|
||||
/*###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__ = 0x00000000;
|
||||
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x000FFFFF;
|
||||
define symbol __ICFEDIT_region_TCM_start__ = 0x1FFF0000;
|
||||
define symbol __ICFEDIT_region_TCM_end__ = 0x1FFFFFFF;
|
||||
define symbol __ICFEDIT_region_ROM_USED_RAM_start__ = 0x10000000;
|
||||
define symbol __ICFEDIT_region_ROM_USED_RAM_end__ = 0x10005FFF;
|
||||
define symbol __ICFEDIT_region_FWLOADER_start__ = 0x10006000;
|
||||
define symbol __ICFEDIT_region_FWLOADER_end__ = 0x1000DFFF;
|
||||
//define symbol __ICFEDIT_region_RECY_RAM_start__ = 0x10002090;
|
||||
//define symbol __ICFEDIT_region_RECY_RAM_end__ = 0x100037FF;
|
||||
define symbol __ICFEDIT_region_BD_RAM_start__ = 0x1000E000;
|
||||
define symbol __ICFEDIT_region_BD_RAM_end__ = 0x1006FFFF;
|
||||
define symbol __ICFEDIT_region_SDRAM_RAM_start__ = 0x30000000;
|
||||
define symbol __ICFEDIT_region_SDRAM_RAM_end__ = 0x301FFFFF;
|
||||
|
||||
/*-Sizes-*/
|
||||
/*define symbol __ICFEDIT_size_cstack__ = 0x400;*/
|
||||
/*define symbol __ICFEDIT_size_heap__ = 0x800;*/
|
||||
/**** 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 TCM_region = mem:[from __ICFEDIT_region_TCM_start__ to __ICFEDIT_region_TCM_end__];
|
||||
define region ROM_USED_RAM_region = mem:[from __ICFEDIT_region_ROM_USED_RAM_start__ to __ICFEDIT_region_ROM_USED_RAM_end__];
|
||||
//define region RECY_RAM_region = mem:[from __ICFEDIT_region_RECY_RAM_start__ to __ICFEDIT_region_RECY_RAM_end__];
|
||||
define region FWLOADER_region = mem:[from __ICFEDIT_region_FWLOADER_start__ to __ICFEDIT_region_FWLOADER_end__];
|
||||
define region BD_RAM_region = mem:[from __ICFEDIT_region_BD_RAM_start__ to __ICFEDIT_region_BD_RAM_end__];
|
||||
define region SDRAM_RAM_region = mem:[from __ICFEDIT_region_SDRAM_RAM_start__ to __ICFEDIT_region_SDRAM_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 };
|
||||
//initialize by copy with packing = none { section __DLIB_PERTHREAD }; // Required in a multi-threaded application
|
||||
|
||||
//do not initialize { section * };
|
||||
|
||||
//place at address mem:__ICFEDIT_intvec_start__ { readonly section .vectors_table };
|
||||
|
||||
|
||||
/*place in RAM_region { readwrite, block CSTACK, block HEAP };*/
|
||||
place in TCM_region { readwrite };
|
||||
|
||||
/****************************************
|
||||
* ROM Section config *
|
||||
****************************************/
|
||||
keep { section .rom };
|
||||
place at start of ROM_region { readonly, section .rom };
|
||||
|
||||
/****************************************
|
||||
* BD RAM Section config *
|
||||
****************************************/
|
||||
keep { section .ram_dedecated_vector_table* };
|
||||
define block .vector_table with fixed order{section .ram_dedecated_vector_table*};
|
||||
|
||||
keep { section .ram_user_define_irq_table* };
|
||||
define block .user_vector_table with fixed order{section .ram_user_define_irq_table*};
|
||||
|
||||
keep { section .ram_user_define_data_table* };
|
||||
define block .user_data_table with fixed order{section .ram_user_define_data_table*};
|
||||
|
||||
define block .rom.bss with fixed order{ section .hal.ram.bss* object hal_misc.o,
|
||||
section .hal.ram.bss* object hal_pinmux.o,
|
||||
section .hal.ram.bss* object diag.o,
|
||||
section .hal.ram.bss* object rtl8195a_ssi_rom.o,
|
||||
section .hal.ram.bss* object rtl8195a_gpio.o,
|
||||
section .hal.ram.bss*,
|
||||
section .timer2_7_vector_table.data*,
|
||||
section .infra.ram.bss*,
|
||||
section .mon.ram.bss*,
|
||||
section .wlan_ram_map* object rom_wlan_ram_map.o,
|
||||
section .wlan_ram_map*,
|
||||
section .libc.ram.bss*,
|
||||
};
|
||||
|
||||
keep { section .start.ram.data* };
|
||||
define block .ram.start.table with fixed order{ section .start.ram.data* };
|
||||
|
||||
keep { section .image1.validate.rodata* };
|
||||
keep { section .infra.ram.data* };
|
||||
keep { section .timer.ram.data* };
|
||||
keep { section .hal.ram.data* };
|
||||
define block .ram_image1.data with fixed order{ section .image1.validate.rodata*,
|
||||
section .infra.ram.data*,
|
||||
section .timer.ram.data*,
|
||||
section .cutb.ram.data*,
|
||||
section .hal.ram.data* object rom.o, // for standard libaray __impure_data_ptr
|
||||
section .cutc.ram.data*,
|
||||
section .hal.ram.data*
|
||||
};
|
||||
define block .ram_image1.bss with fixed order{ //section .hal.flash.data*,
|
||||
section .hal.sdrc.data*
|
||||
};
|
||||
|
||||
define block .ram_image1.text with fixed order{ section .hal.ram.text*,
|
||||
section .hal.sdrc.text*,
|
||||
//section .text* object startup.o,
|
||||
section .infra.ram.text*,
|
||||
};
|
||||
|
||||
define block IMAGE1 with fixed order { section LOADER };
|
||||
define block IMAGE1_DBG with fixed order { block .ram.start.table, block .ram_image1.data, block .ram_image1.bss, block .ram_image1.text };
|
||||
|
||||
place at start of ROM_USED_RAM_region { readwrite,
|
||||
block .vector_table,
|
||||
block .user_vector_table,
|
||||
block .user_data_table,
|
||||
block .rom.bss,
|
||||
block IMAGE1
|
||||
};
|
||||
|
||||
keep { section .fwloader.start_ram.data* };
|
||||
define block .fwloader.start.table1 with fixed order{ section .fwloader.start_ram.data* };
|
||||
|
||||
keep { section .fwloader.validate.rodata* };
|
||||
define block .fwloader.start.table2 with fixed order{ section .fwloader.validate.rodata* };
|
||||
|
||||
//keep { section .fwloader.ram.data* };
|
||||
//define block .fwloader_ram.data with fixed order{ section .fwloader.ram.data*,
|
||||
// section .data* object fw_loader_main.o,
|
||||
// section .bss* object fw_loader_main.o,
|
||||
// section .rodata* object fw_loader_main.o
|
||||
// };
|
||||
|
||||
//keep { section .fwloader.ram.start* };
|
||||
//define block .fwloader_ram.text with fixed order{
|
||||
// section .text* object fw_loader_main.o
|
||||
// };
|
||||
|
||||
|
||||
|
||||
define block FWLOADER with fixed order { block .fwloader.start.table1,
|
||||
block .fwloader.start.table2,
|
||||
// block .fwloader_ram.text,
|
||||
// block .fwloader_ram.data
|
||||
};
|
||||
|
||||
place at start of FWLOADER_region { readwrite, block FWLOADER };
|
||||
|
||||
|
||||
|
||||
keep { section .image2.ram.data* };
|
||||
define block .image2.start.table1 with fixed order{ section .image2.ram.data* };
|
||||
|
||||
keep { section .image2.validate.rodata*, section .custom.validate.rodata* };
|
||||
define block .image2.start.table2 with fixed order{ section .image2.validate.rodata*, section .custom.validate.rodata* };
|
||||
|
||||
define block SHT$$PREINIT_ARRAY { preinit_array };
|
||||
define block SHT$$INIT_ARRAY { init_array };
|
||||
define block CPP_INIT with fixed order { block SHT$$PREINIT_ARRAY,
|
||||
block SHT$$INIT_ARRAY };
|
||||
|
||||
define block .ram_image2.text with fixed order{ section .infra.ram.start*,
|
||||
section .rodata*,
|
||||
block CPP_INIT,
|
||||
section .mon.ram.text*,
|
||||
section .hal.flash.text*,
|
||||
section .hal.gpio.text*,
|
||||
section .text*,
|
||||
section CODE,
|
||||
section .otg.rom.text,
|
||||
section Veneer object startup.o,
|
||||
section __DLIB_PERTHREAD,
|
||||
//section .mdns.text
|
||||
};
|
||||
|
||||
define block .ram.data with fixed order{ section .data*,
|
||||
section DATA,
|
||||
section .ram.otg.data.a,
|
||||
section .iar.init_table,
|
||||
//section .mdns.data
|
||||
};
|
||||
|
||||
define block IMAGE2 with fixed order { block .image2.start.table1, block .image2.start.table2, block .ram_image2.text, block .ram.data };
|
||||
|
||||
define block .ram.bss with fixed order{ section .bss*,
|
||||
section .ssl_ram_map,
|
||||
section .hal.flash.data*,
|
||||
section .hal.gpio.data*,
|
||||
section COMMON,
|
||||
section .bdsram.data*,
|
||||
section .bss* object heap_5.o
|
||||
};
|
||||
define block .bf_data with fixed order{ section .bfsram.data* };
|
||||
define block .heap with fixed order{ section .heap* };
|
||||
define block .stack_dummy with fixed order { section .stack };
|
||||
place at start of BD_RAM_region { readwrite,
|
||||
block IMAGE2,
|
||||
//block IMAGE1_DBG,
|
||||
block .ram.bss,
|
||||
//block .bf_data,
|
||||
};
|
||||
|
||||
//place at address mem:0x10052b00 { readwrite,
|
||||
place at end of BD_RAM_region { readwrite,
|
||||
block .bf_data,
|
||||
};
|
||||
|
||||
define block SDRAM with fixed order{ section .sdram.text*,
|
||||
section .sdram.data*,
|
||||
section .mdns.text*,
|
||||
section .mdns.data*,
|
||||
section .text object HomeKit*,
|
||||
section .text object fe_*,
|
||||
section .text object ge_*,
|
||||
section .text object sc_*,
|
||||
section .text object auth_poly1305_donna.o,
|
||||
section .text object sc_muladd.o
|
||||
};
|
||||
place at start of SDRAM_RAM_region { readwrite,
|
||||
block SDRAM,
|
||||
//block IMAGE1_DBG
|
||||
};
|
||||
|
||||
|
||||
/* TCM placement */
|
||||
define overlay TCM_overlay { section .tcm.heap,
|
||||
section .tcm.bss,
|
||||
section .bss object memp.o,
|
||||
block .heap,
|
||||
block .stack_dummy
|
||||
};
|
||||
/* dummy code placement */
|
||||
define overlay TCM_overlay { block IMAGE1_DBG };
|
||||
place at start of TCM_region { readwrite,
|
||||
overlay TCM_overlay
|
||||
};
|
||||
|
||||
define exported symbol __rom_bss_start__ = 0x10000300; // use in rom
|
||||
define exported symbol __rom_bss_end__ = 0x10000bc8; // use in rom
|
||||
define exported symbol __ram_start_table_start__= 0x10000bc8; // use in rom
|
||||
define exported symbol __image1_validate_code__= 0x10000bdc; // needed by ram code
|
||||
define exported symbol _rtl_impure_ptr = 0x10001c60; // for standard library
|
||||
|
||||
@@ -1,474 +1,474 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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 "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);
|
||||
extern WEAK void bootloader_start(void);
|
||||
extern bool mfg_test_for_app (void);
|
||||
/******************************************************
|
||||
* Variables Definitions
|
||||
******************************************************/
|
||||
|
||||
static uint32_t _default_start_time = 0;
|
||||
static mico_timer_t _button_EL_timer;
|
||||
|
||||
const platform_gpio_t platform_gpio_pins[] =
|
||||
{
|
||||
/* Common GPIOs for internal use */
|
||||
[MICO_SYS_LED] = { .pin = PB_2, },
|
||||
//[MICO_RF_LED] = { .pin = PA_5, }, //MICO_GPIO_16
|
||||
[BOOT_SEL] = { .pin = PC_4,}, //MICO_GPIO_16
|
||||
[MFG_SEL] = { .pin = PC_5,}, //MICO_GPIO_30
|
||||
[EasyLink_BUTTON] = { .pin = PB_3,}, //MICO_GPIO_11
|
||||
|
||||
/* GPIOs for external use */
|
||||
[MICO_GPIO_12] = { .pin = PC_0, },
|
||||
[MICO_GPIO_13] = { .pin = PC_3, },
|
||||
[MICO_GPIO_14] = { .pin = PC_2, },
|
||||
[MICO_GPIO_15] = { .pin = PC_1, },
|
||||
[MICO_GPIO_19] = { .pin = PC_4, },
|
||||
[MICO_GPIO_20] = { .pin = PC_5, },
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Possible compile time inputs:
|
||||
* - Set which ADC peripheral to use for each ADC. All on one ADC allows sequential conversion on all inputs. All on separate ADCs allows concurrent conversion.
|
||||
*/
|
||||
/* TODO : These need fixing */
|
||||
const platform_adc_t platform_adc_peripherals[] =
|
||||
{
|
||||
[MICO_ADC_1] =
|
||||
{
|
||||
.pin = AD_1,
|
||||
},
|
||||
|
||||
[MICO_ADC_2] =
|
||||
{
|
||||
.pin = AD_2,
|
||||
},
|
||||
|
||||
[MICO_ADC_3] =
|
||||
{
|
||||
.pin = AD_3,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/* PWM mappings */
|
||||
const platform_pwm_t platform_pwm_peripherals[] =
|
||||
{
|
||||
[MICO_PWM_1] =
|
||||
{
|
||||
.pin = PC_0,
|
||||
},
|
||||
[MICO_PWM_2] =
|
||||
{
|
||||
.pin = PC_1,
|
||||
},
|
||||
[MICO_PWM_3] =
|
||||
{
|
||||
.pin = PC_2,
|
||||
},
|
||||
[MICO_PWM_4] =
|
||||
{
|
||||
.pin = PC_3,
|
||||
},
|
||||
/* TODO: fill in the other options here ... */
|
||||
};
|
||||
|
||||
const platform_spi_t platform_spi_peripherals[] =
|
||||
{
|
||||
[MICO_SPI_1] =
|
||||
{
|
||||
.mosi = PC_2,
|
||||
.miso = PC_3,
|
||||
.sclk = PC_1,
|
||||
.ssel = PC_0,
|
||||
},
|
||||
};
|
||||
platform_uart_driver_t platform_spi_drivers[MICO_UART_MAX];
|
||||
|
||||
const platform_uart_t platform_uart_peripherals[] =
|
||||
{
|
||||
[MICO_UART_1] =
|
||||
{
|
||||
.tx = PA_7,
|
||||
.rx = PA_6,
|
||||
},
|
||||
};
|
||||
platform_uart_driver_t platform_uart_drivers[MICO_UART_MAX];
|
||||
|
||||
const platform_i2c_t platform_i2c_peripherals[] =
|
||||
{
|
||||
[MICO_I2C_1] =
|
||||
{
|
||||
.sda = PB_3,
|
||||
.scl = PB_2,
|
||||
},
|
||||
};
|
||||
platform_i2c_driver_t platform_i2c_drivers[MICO_I2C_MAX];
|
||||
|
||||
/* Flash memory devices */
|
||||
const platform_flash_t platform_flash_peripherals[] =
|
||||
{
|
||||
[MICO_FLASH_SPI] =
|
||||
{
|
||||
.flash_type = FLASH_TYPE_SPI,
|
||||
.flash_start_addr = 0x00000000,
|
||||
.flash_length = 0x200000,
|
||||
.flash_readonly_start = 0x9000,
|
||||
.flash_readonly_len = 0x2000,
|
||||
},
|
||||
};
|
||||
|
||||
platform_flash_driver_t platform_flash_drivers[MICO_FLASH_MAX];
|
||||
|
||||
#if 1
|
||||
/* Logic partition on flash devices */
|
||||
const mico_logic_partition_t mico_partitions[] =
|
||||
{
|
||||
[MICO_PARTITION_BOOTLOADER] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "Bootloader",
|
||||
.partition_start_addr = 0xB000,
|
||||
.partition_length = 0x8000, //32k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_DIS,
|
||||
},
|
||||
[MICO_PARTITION_APPLICATION] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "Application",
|
||||
.partition_start_addr = 0x13000,
|
||||
.partition_length = 0x90000, //576k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[MICO_PARTITION_RF_FIRMWARE] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_NONE,
|
||||
},
|
||||
[MICO_PARTITION_FILESYS] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_NONE,
|
||||
},
|
||||
|
||||
[MICO_PARTITION_PARAMETER_1] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "PARAMETER1",
|
||||
.partition_start_addr = 0x000E0000,
|
||||
.partition_length = 0x4000, // 16k 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 = 0x000E4000,
|
||||
.partition_length = 0x4000, //16k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[MICO_PARTITION_ATE] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "ATE",
|
||||
.partition_start_addr = 0x00100000,
|
||||
.partition_length = 0x60000, //384k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[MICO_PARTITION_OTA_TEMP] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "OTA Storage",
|
||||
.partition_start_addr = 0x00160000,
|
||||
.partition_length = 0x90000, //576k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
/******************************************************
|
||||
* Interrupt Handler Definitions
|
||||
******************************************************/
|
||||
/******************************************************
|
||||
* Function Definitions
|
||||
******************************************************/
|
||||
bool watchdog_check_last_reset( void )
|
||||
{
|
||||
#if 0
|
||||
if ( RCC->CSR & RCC_CSR_WDGRSTF )
|
||||
{
|
||||
/* Clear the flag and return */
|
||||
RCC->CSR |= RCC_CSR_RMVF;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
void platform_init_peripheral_irq_priorities( void )
|
||||
{
|
||||
#if 0
|
||||
/* Interrupt priority setup. Called by WICED/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( DMA1_Stream3_IRQn, 3 ); /* WLAN SPI DMA */
|
||||
NVIC_SetPriority( USART1_IRQn , 6 ); /* MICO_UART_1 */
|
||||
NVIC_SetPriority( USART6_IRQn , 6 ); /* MICO_UART_2 */
|
||||
NVIC_SetPriority( DMA2_Stream7_IRQn, 7 ); /* MICO_UART_1 TX DMA */
|
||||
NVIC_SetPriority( DMA2_Stream2_IRQn, 7 ); /* MICO_UART_1 RX DMA */
|
||||
NVIC_SetPriority( DMA2_Stream6_IRQn, 7 ); /* MICO_UART_2 TX DMA */
|
||||
NVIC_SetPriority( DMA2_Stream1_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 */
|
||||
#endif
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
MicoGpioInitialize((mico_gpio_t)BOOT_SEL, INPUT_PULL_UP);
|
||||
MicoGpioInitialize((mico_gpio_t)MFG_SEL, INPUT_PULL_UP);
|
||||
|
||||
init.gpio = EasyLink_BUTTON;
|
||||
init.pressed_func = PlatformEasyLinkButtonClickedCallback;
|
||||
init.long_pressed_func = PlatformEasyLinkButtonLongPressedCallback;
|
||||
init.long_pressed_timeout = RestoreDefault_TimeOut;
|
||||
|
||||
button_init( IOBUTTON_EASYLINK, init );
|
||||
|
||||
/* Initialise RTC */
|
||||
platform_rtc_init( );
|
||||
}
|
||||
|
||||
#ifndef STDIO_BUFFER_SIZE
|
||||
#define STDIO_BUFFER_SIZE 64
|
||||
#endif
|
||||
|
||||
#ifndef MICO_DISABLE_STDIO
|
||||
static const mico_uart_config_t stdio_uart_config =
|
||||
{
|
||||
.baud_rate = STDIO_UART_BAUDRATE,
|
||||
.data_width = DATA_WIDTH_8BIT,
|
||||
.parity = NO_PARITY,
|
||||
.stop_bits = STOP_BITS_1,
|
||||
.flow_control = FLOW_CONTROL_DISABLED,
|
||||
.flags = 0,
|
||||
};
|
||||
|
||||
static volatile ring_buffer_t stdio_rx_buffer;
|
||||
static volatile uint8_t stdio_rx_data[STDIO_BUFFER_SIZE];
|
||||
#endif /* #ifndef MICO_DISABLE_STDIO */
|
||||
|
||||
void init_platform_bootloader( void )
|
||||
{
|
||||
ring_buffer_init ( (ring_buffer_t*)&stdio_rx_buffer, (uint8_t*)stdio_rx_data, STDIO_BUFFER_SIZE );
|
||||
platform_uart_init( &platform_uart_drivers[STDIO_UART], &platform_uart_peripherals[STDIO_UART], &stdio_uart_config, (ring_buffer_t*)&stdio_rx_buffer );
|
||||
|
||||
MicoGpioInitialize(BOOT_SEL, INPUT_PULL_UP);
|
||||
MicoGpioInitialize(MFG_SEL, INPUT_PULL_UP);
|
||||
MicoGpioInitialize( (mico_gpio_t)EasyLink_BUTTON, INPUT_PULL_UP );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MicoSysLed(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
MicoGpioOutputLow( (mico_gpio_t)MICO_SYS_LED );
|
||||
} else {
|
||||
MicoGpioOutputHigh( (mico_gpio_t)MICO_SYS_LED );
|
||||
}
|
||||
}
|
||||
|
||||
void MicoRfLed(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
MicoGpioOutputLow( (mico_gpio_t)MICO_RF_LED );
|
||||
} else {
|
||||
MicoGpioOutputHigh( (mico_gpio_t)MICO_RF_LED );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool mfg_test_for_app (void)
|
||||
{
|
||||
mico_uart_config_t uart_config;
|
||||
ring_buffer_t rx_buffer;
|
||||
uint8_t * rx_data;
|
||||
int ret = false;
|
||||
int i,j;
|
||||
uint8_t c;
|
||||
|
||||
rx_data = malloc (1024);
|
||||
require (rx_data, exit);
|
||||
|
||||
/* Initialize UART interface */
|
||||
uart_config.baud_rate = 921600;
|
||||
uart_config.data_width = DATA_WIDTH_8BIT;
|
||||
uart_config.parity = NO_PARITY;
|
||||
uart_config.stop_bits = STOP_BITS_1;
|
||||
uart_config.flow_control = FLOW_CONTROL_DISABLED;
|
||||
uart_config.flags = UART_WAKEUP_DISABLE;
|
||||
|
||||
ring_buffer_init ((ring_buffer_t *)&rx_buffer, (uint8_t *)rx_data, 1024);
|
||||
MicoUartInitialize (MFG_TEST, &uart_config, (ring_buffer_t *)&rx_buffer);
|
||||
|
||||
for(i=0, j=0;i<20;i++) {
|
||||
if (kNoErr != MicoUartRecv( MFG_TEST, &c, 1, 10))
|
||||
continue;
|
||||
|
||||
if (c == '#') {
|
||||
j++;
|
||||
if (j > 3) {
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
MicoUartFinalize(MFG_TEST);
|
||||
free(rx_data);
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool MicoShouldEnterMFGMode(void)
|
||||
{
|
||||
if(MicoGpioInputGet((mico_gpio_t)BOOT_SEL)==false && MicoGpioInputGet((mico_gpio_t)MFG_SEL)==false)
|
||||
return true;
|
||||
else {
|
||||
#ifndef BOOTLOADER
|
||||
if (mfg_test_for_app()) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool MicoShouldEnterBootloader(void)
|
||||
{
|
||||
if(MicoGpioInputGet((mico_gpio_t)BOOT_SEL)==false && MicoGpioInputGet((mico_gpio_t)MFG_SEL)==true)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MicoShouldEnterATEMode(void)
|
||||
{
|
||||
if(MicoGpioInputGet((mico_gpio_t)BOOT_SEL)==false && MicoGpioInputGet((mico_gpio_t)EasyLink_BUTTON)==false)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static int boot_blink_led = 0;
|
||||
|
||||
void ymodem_upload_done(void)
|
||||
{
|
||||
boot_blink_led = 1;
|
||||
MicoGpioInitialize( (mico_gpio_t)MICO_SYS_LED, OUTPUT_PUSH_PULL );
|
||||
}
|
||||
|
||||
void platform_bootloader_tick(void)
|
||||
{
|
||||
static int led_state = 0;
|
||||
|
||||
if (boot_blink_led == 0)
|
||||
return;
|
||||
|
||||
if (led_state == 1) {
|
||||
MicoSysLed(1);
|
||||
led_state = 0;
|
||||
} else {
|
||||
MicoSysLed(0);
|
||||
led_state = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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 "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);
|
||||
extern WEAK void bootloader_start(void);
|
||||
extern bool mfg_test_for_app (void);
|
||||
/******************************************************
|
||||
* Variables Definitions
|
||||
******************************************************/
|
||||
|
||||
static uint32_t _default_start_time = 0;
|
||||
static mico_timer_t _button_EL_timer;
|
||||
|
||||
const platform_gpio_t platform_gpio_pins[] =
|
||||
{
|
||||
/* Common GPIOs for internal use */
|
||||
[MICO_SYS_LED] = { .pin = PB_2, },
|
||||
//[MICO_RF_LED] = { .pin = PA_5, }, //MICO_GPIO_16
|
||||
[BOOT_SEL] = { .pin = PC_4,}, //MICO_GPIO_16
|
||||
[MFG_SEL] = { .pin = PC_5,}, //MICO_GPIO_30
|
||||
[EasyLink_BUTTON] = { .pin = PB_3,}, //MICO_GPIO_11
|
||||
|
||||
/* GPIOs for external use */
|
||||
[MICO_GPIO_12] = { .pin = PC_0, },
|
||||
[MICO_GPIO_13] = { .pin = PC_3, },
|
||||
[MICO_GPIO_14] = { .pin = PC_2, },
|
||||
[MICO_GPIO_15] = { .pin = PC_1, },
|
||||
[MICO_GPIO_19] = { .pin = PC_4, },
|
||||
[MICO_GPIO_20] = { .pin = PC_5, },
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Possible compile time inputs:
|
||||
* - Set which ADC peripheral to use for each ADC. All on one ADC allows sequential conversion on all inputs. All on separate ADCs allows concurrent conversion.
|
||||
*/
|
||||
/* TODO : These need fixing */
|
||||
const platform_adc_t platform_adc_peripherals[] =
|
||||
{
|
||||
[MICO_ADC_1] =
|
||||
{
|
||||
.pin = AD_1,
|
||||
},
|
||||
|
||||
[MICO_ADC_2] =
|
||||
{
|
||||
.pin = AD_2,
|
||||
},
|
||||
|
||||
[MICO_ADC_3] =
|
||||
{
|
||||
.pin = AD_3,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/* PWM mappings */
|
||||
const platform_pwm_t platform_pwm_peripherals[] =
|
||||
{
|
||||
[MICO_PWM_1] =
|
||||
{
|
||||
.pin = PC_0,
|
||||
},
|
||||
[MICO_PWM_2] =
|
||||
{
|
||||
.pin = PC_1,
|
||||
},
|
||||
[MICO_PWM_3] =
|
||||
{
|
||||
.pin = PC_2,
|
||||
},
|
||||
[MICO_PWM_4] =
|
||||
{
|
||||
.pin = PC_3,
|
||||
},
|
||||
/* TODO: fill in the other options here ... */
|
||||
};
|
||||
|
||||
const platform_spi_t platform_spi_peripherals[] =
|
||||
{
|
||||
[MICO_SPI_1] =
|
||||
{
|
||||
.mosi = PC_2,
|
||||
.miso = PC_3,
|
||||
.sclk = PC_1,
|
||||
.ssel = PC_0,
|
||||
},
|
||||
};
|
||||
platform_uart_driver_t platform_spi_drivers[MICO_UART_MAX];
|
||||
|
||||
const platform_uart_t platform_uart_peripherals[] =
|
||||
{
|
||||
[MICO_UART_1] =
|
||||
{
|
||||
.tx = PA_7,
|
||||
.rx = PA_6,
|
||||
},
|
||||
};
|
||||
platform_uart_driver_t platform_uart_drivers[MICO_UART_MAX];
|
||||
|
||||
const platform_i2c_t platform_i2c_peripherals[] =
|
||||
{
|
||||
[MICO_I2C_1] =
|
||||
{
|
||||
.sda = PB_3,
|
||||
.scl = PB_2,
|
||||
},
|
||||
};
|
||||
platform_i2c_driver_t platform_i2c_drivers[MICO_I2C_MAX];
|
||||
|
||||
/* Flash memory devices */
|
||||
const platform_flash_t platform_flash_peripherals[] =
|
||||
{
|
||||
[MICO_FLASH_SPI] =
|
||||
{
|
||||
.flash_type = FLASH_TYPE_SPI,
|
||||
.flash_start_addr = 0x00000000,
|
||||
.flash_length = 0x200000,
|
||||
.flash_readonly_start = 0x9000,
|
||||
.flash_readonly_len = 0x2000,
|
||||
},
|
||||
};
|
||||
|
||||
platform_flash_driver_t platform_flash_drivers[MICO_FLASH_MAX];
|
||||
|
||||
#if 1
|
||||
/* Logic partition on flash devices */
|
||||
const mico_logic_partition_t mico_partitions[] =
|
||||
{
|
||||
[MICO_PARTITION_BOOTLOADER] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "Bootloader",
|
||||
.partition_start_addr = 0xB000,
|
||||
.partition_length = 0x8000, //32k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_DIS,
|
||||
},
|
||||
[MICO_PARTITION_APPLICATION] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "Application",
|
||||
.partition_start_addr = 0x13000,
|
||||
.partition_length = 0x90000, //576k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[MICO_PARTITION_RF_FIRMWARE] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_NONE,
|
||||
},
|
||||
[MICO_PARTITION_FILESYS] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_NONE,
|
||||
},
|
||||
|
||||
[MICO_PARTITION_PARAMETER_1] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "PARAMETER1",
|
||||
.partition_start_addr = 0x000E0000,
|
||||
.partition_length = 0x4000, // 16k 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 = 0x000E4000,
|
||||
.partition_length = 0x4000, //16k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[MICO_PARTITION_ATE] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "ATE",
|
||||
.partition_start_addr = 0x00100000,
|
||||
.partition_length = 0x60000, //384k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[MICO_PARTITION_OTA_TEMP] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "OTA Storage",
|
||||
.partition_start_addr = 0x00160000,
|
||||
.partition_length = 0x90000, //576k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
/******************************************************
|
||||
* Interrupt Handler Definitions
|
||||
******************************************************/
|
||||
/******************************************************
|
||||
* Function Definitions
|
||||
******************************************************/
|
||||
bool watchdog_check_last_reset( void )
|
||||
{
|
||||
#if 0
|
||||
if ( RCC->CSR & RCC_CSR_WDGRSTF )
|
||||
{
|
||||
/* Clear the flag and return */
|
||||
RCC->CSR |= RCC_CSR_RMVF;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
void platform_init_peripheral_irq_priorities( void )
|
||||
{
|
||||
#if 0
|
||||
/* Interrupt priority setup. Called by WICED/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( DMA1_Stream3_IRQn, 3 ); /* WLAN SPI DMA */
|
||||
NVIC_SetPriority( USART1_IRQn , 6 ); /* MICO_UART_1 */
|
||||
NVIC_SetPriority( USART6_IRQn , 6 ); /* MICO_UART_2 */
|
||||
NVIC_SetPriority( DMA2_Stream7_IRQn, 7 ); /* MICO_UART_1 TX DMA */
|
||||
NVIC_SetPriority( DMA2_Stream2_IRQn, 7 ); /* MICO_UART_1 RX DMA */
|
||||
NVIC_SetPriority( DMA2_Stream6_IRQn, 7 ); /* MICO_UART_2 TX DMA */
|
||||
NVIC_SetPriority( DMA2_Stream1_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 */
|
||||
#endif
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
MicoGpioInitialize((mico_gpio_t)BOOT_SEL, INPUT_PULL_UP);
|
||||
MicoGpioInitialize((mico_gpio_t)MFG_SEL, INPUT_PULL_UP);
|
||||
|
||||
init.gpio = EasyLink_BUTTON;
|
||||
init.pressed_func = PlatformEasyLinkButtonClickedCallback;
|
||||
init.long_pressed_func = PlatformEasyLinkButtonLongPressedCallback;
|
||||
init.long_pressed_timeout = RestoreDefault_TimeOut;
|
||||
|
||||
button_init( IOBUTTON_EASYLINK, init );
|
||||
|
||||
/* Initialise RTC */
|
||||
platform_rtc_init( );
|
||||
}
|
||||
|
||||
#ifndef STDIO_BUFFER_SIZE
|
||||
#define STDIO_BUFFER_SIZE 64
|
||||
#endif
|
||||
|
||||
#ifndef MICO_DISABLE_STDIO
|
||||
static const mico_uart_config_t stdio_uart_config =
|
||||
{
|
||||
.baud_rate = STDIO_UART_BAUDRATE,
|
||||
.data_width = DATA_WIDTH_8BIT,
|
||||
.parity = NO_PARITY,
|
||||
.stop_bits = STOP_BITS_1,
|
||||
.flow_control = FLOW_CONTROL_DISABLED,
|
||||
.flags = 0,
|
||||
};
|
||||
|
||||
static volatile ring_buffer_t stdio_rx_buffer;
|
||||
static volatile uint8_t stdio_rx_data[STDIO_BUFFER_SIZE];
|
||||
#endif /* #ifndef MICO_DISABLE_STDIO */
|
||||
|
||||
void init_platform_bootloader( void )
|
||||
{
|
||||
ring_buffer_init ( (ring_buffer_t*)&stdio_rx_buffer, (uint8_t*)stdio_rx_data, STDIO_BUFFER_SIZE );
|
||||
platform_uart_init( &platform_uart_drivers[STDIO_UART], &platform_uart_peripherals[STDIO_UART], &stdio_uart_config, (ring_buffer_t*)&stdio_rx_buffer );
|
||||
|
||||
MicoGpioInitialize(BOOT_SEL, INPUT_PULL_UP);
|
||||
MicoGpioInitialize(MFG_SEL, INPUT_PULL_UP);
|
||||
MicoGpioInitialize( (mico_gpio_t)EasyLink_BUTTON, INPUT_PULL_UP );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MicoSysLed(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
MicoGpioOutputLow( (mico_gpio_t)MICO_SYS_LED );
|
||||
} else {
|
||||
MicoGpioOutputHigh( (mico_gpio_t)MICO_SYS_LED );
|
||||
}
|
||||
}
|
||||
|
||||
void MicoRfLed(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
MicoGpioOutputLow( (mico_gpio_t)MICO_RF_LED );
|
||||
} else {
|
||||
MicoGpioOutputHigh( (mico_gpio_t)MICO_RF_LED );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool mfg_test_for_app (void)
|
||||
{
|
||||
mico_uart_config_t uart_config;
|
||||
ring_buffer_t rx_buffer;
|
||||
uint8_t * rx_data;
|
||||
int ret = false;
|
||||
int i,j;
|
||||
uint8_t c;
|
||||
|
||||
rx_data = malloc (1024);
|
||||
require (rx_data, exit);
|
||||
|
||||
/* Initialize UART interface */
|
||||
uart_config.baud_rate = 921600;
|
||||
uart_config.data_width = DATA_WIDTH_8BIT;
|
||||
uart_config.parity = NO_PARITY;
|
||||
uart_config.stop_bits = STOP_BITS_1;
|
||||
uart_config.flow_control = FLOW_CONTROL_DISABLED;
|
||||
uart_config.flags = UART_WAKEUP_DISABLE;
|
||||
|
||||
ring_buffer_init ((ring_buffer_t *)&rx_buffer, (uint8_t *)rx_data, 1024);
|
||||
MicoUartInitialize (MFG_TEST, &uart_config, (ring_buffer_t *)&rx_buffer);
|
||||
|
||||
for(i=0, j=0;i<20;i++) {
|
||||
if (kNoErr != MicoUartRecv( MFG_TEST, &c, 1, 10))
|
||||
continue;
|
||||
|
||||
if (c == '#') {
|
||||
j++;
|
||||
if (j > 3) {
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
MicoUartFinalize(MFG_TEST);
|
||||
free(rx_data);
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool MicoShouldEnterMFGMode(void)
|
||||
{
|
||||
if(MicoGpioInputGet((mico_gpio_t)BOOT_SEL)==false && MicoGpioInputGet((mico_gpio_t)MFG_SEL)==false)
|
||||
return true;
|
||||
else {
|
||||
#ifndef BOOTLOADER
|
||||
if (mfg_test_for_app()) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool MicoShouldEnterBootloader(void)
|
||||
{
|
||||
if(MicoGpioInputGet((mico_gpio_t)BOOT_SEL)==false && MicoGpioInputGet((mico_gpio_t)MFG_SEL)==true)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MicoShouldEnterATEMode(void)
|
||||
{
|
||||
if(MicoGpioInputGet((mico_gpio_t)BOOT_SEL)==false && MicoGpioInputGet((mico_gpio_t)EasyLink_BUTTON)==false)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static int boot_blink_led = 0;
|
||||
|
||||
void ymodem_upload_done(void)
|
||||
{
|
||||
boot_blink_led = 1;
|
||||
MicoGpioInitialize( (mico_gpio_t)MICO_SYS_LED, OUTPUT_PUSH_PULL );
|
||||
}
|
||||
|
||||
void platform_bootloader_tick(void)
|
||||
{
|
||||
static int led_state = 0;
|
||||
|
||||
if (boot_blink_led == 0)
|
||||
return;
|
||||
|
||||
if (led_state == 1) {
|
||||
MicoSysLed(1);
|
||||
led_state = 0;
|
||||
} else {
|
||||
MicoSysLed(0);
|
||||
led_state = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,217 +1,223 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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
|
||||
******************************************************/
|
||||
|
||||
|
||||
#define MICO_UNUSED 0xFF
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_SYS_LED,
|
||||
//MICO_RF_LED,
|
||||
BOOT_SEL,
|
||||
MFG_SEL,
|
||||
EasyLink_BUTTON,
|
||||
MICO_GPIO_1 ,
|
||||
MICO_GPIO_2,
|
||||
MICO_GPIO_3,
|
||||
MICO_GPIO_4,
|
||||
MICO_GPIO_5,
|
||||
MICO_GPIO_6,
|
||||
MICO_GPIO_7,
|
||||
MICO_GPIO_8,
|
||||
MICO_GPIO_9,
|
||||
MICO_GPIO_10,
|
||||
MICO_GPIO_11,
|
||||
MICO_GPIO_12,
|
||||
MICO_GPIO_13,
|
||||
MICO_GPIO_14,
|
||||
MICO_GPIO_15,
|
||||
MICO_GPIO_16,
|
||||
MICO_GPIO_17,
|
||||
MICO_GPIO_18,
|
||||
MICO_GPIO_19,
|
||||
MICO_GPIO_20,
|
||||
MICO_GPIO_21,
|
||||
MICO_GPIO_22,
|
||||
MICO_GPIO_23,
|
||||
MICO_GPIO_24,
|
||||
MICO_GPIO_25,
|
||||
|
||||
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_1,
|
||||
MICO_PWM_2,
|
||||
MICO_PWM_3,
|
||||
MICO_PWM_4,
|
||||
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_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_FILESYS,
|
||||
MICO_PARTITION_USER_MAX
|
||||
} mico_user_partition_t;
|
||||
|
||||
|
||||
#ifdef BOOTLOADER
|
||||
#define STDIO_UART MICO_UART_1
|
||||
#define STDIO_UART_BAUDRATE (921600)
|
||||
#else
|
||||
#define STDIO_UART MICO_UART_NONE
|
||||
#define STDIO_UART_BAUDRATE (115200)
|
||||
#endif
|
||||
|
||||
#define UART_FOR_APP MICO_UART_1
|
||||
#define MFG_TEST MICO_UART_1
|
||||
#define MFG_BAUDRATE 921600
|
||||
#define CLI_UART MICO_UART_2
|
||||
|
||||
/* Components connected to external I/Os*/
|
||||
#define Standby_SEL (MICO_GPIO_NONE)
|
||||
#define MICO_RF_LED (MICO_GPIO_NONE)
|
||||
|
||||
/* I/O connection <-> Peripheral Connections */
|
||||
#define MICO_I2C_CP (MICO_I2C_1)
|
||||
|
||||
#define USE_MICO_SPI_FLASH
|
||||
|
||||
#define MICO_FLASH_FOR_PARA MICO_FLASH_SPI
|
||||
#define PARA_START_ADDRESS (uint32_t)0x00000000
|
||||
#define PARA_END_ADDRESS (uint32_t)0x00000FFF
|
||||
#define PARA_FLASH_SIZE (PARA_END_ADDRESS - PARA_START_ADDRESS + 1) /* 4k bytes*/
|
||||
|
||||
|
||||
/* Arduino extention connector */
|
||||
#define Arduino_RXD (MICO_GPIO_NONE)
|
||||
#define Arduino_TXD (MICO_GPIO_NONE)
|
||||
#define Arduino_D2 (MICO_GPIO_NONE)
|
||||
#define Arduino_D3 (MICO_GPIO_NONE)
|
||||
#define Arduino_D4 (MICO_GPIO_NONE)
|
||||
#define Arduino_D5 (MICO_GPIO_NONE)
|
||||
#define Arduino_D6 (MICO_GPIO_NONE)
|
||||
#define Arduino_D7 (MICO_GPIO_NONE)
|
||||
//
|
||||
#define Arduino_D8 (MICO_GPIO_NONE)
|
||||
#define Arduino_D9 (MICO_GPIO_NONE)
|
||||
#define Arduino_CS (MICO_GPIO_NONE)//(MICO_GPIO_12)
|
||||
#define Arduino_SI (MICO_GPIO_NONE)//(MICO_GPIO_14)
|
||||
#define Arduino_SO (MICO_GPIO_NONE)//(MICO_GPIO_13)
|
||||
#define Arduino_SCK (MICO_GPIO_NONE)//(MICO_GPIO_15)
|
||||
#define Arduino_SDA (MICO_GPIO_19)
|
||||
#define Arduino_SCL (MICO_GPIO_20)
|
||||
//
|
||||
#define Arduino_A0 (MICO_ADC_NONE)
|
||||
#define Arduino_A1 (MICO_ADC_NONE)
|
||||
#define Arduino_A2 (MICO_ADC_NONE)
|
||||
#define Arduino_A3 (MICO_ADC_NONE)
|
||||
#define Arduino_A4 (MICO_ADC_NONE)
|
||||
#define Arduino_A5 (MICO_ADC_NONE)
|
||||
//
|
||||
#define Arduino_I2C (MICO_SPI_NONE)
|
||||
#define Arduino_SPI (MICO_SPI_NONE)
|
||||
#define Arduino_UART (MICO_UART_1)
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
#define MICO_I2C_CP (Arduino_I2C)
|
||||
#include "MiCOKit_EXT/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
|
||||
******************************************************/
|
||||
|
||||
|
||||
#define MICO_UNUSED 0xFF
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_SYS_LED,
|
||||
//MICO_RF_LED,
|
||||
BOOT_SEL,
|
||||
MFG_SEL,
|
||||
EasyLink_BUTTON,
|
||||
MICO_GPIO_1 ,
|
||||
MICO_GPIO_2,
|
||||
MICO_GPIO_3,
|
||||
MICO_GPIO_4,
|
||||
MICO_GPIO_5,
|
||||
MICO_GPIO_6,
|
||||
MICO_GPIO_7,
|
||||
MICO_GPIO_8,
|
||||
MICO_GPIO_9,
|
||||
MICO_GPIO_10,
|
||||
MICO_GPIO_11,
|
||||
MICO_GPIO_12,
|
||||
MICO_GPIO_13,
|
||||
MICO_GPIO_14,
|
||||
MICO_GPIO_15,
|
||||
MICO_GPIO_16,
|
||||
MICO_GPIO_17,
|
||||
MICO_GPIO_18,
|
||||
MICO_GPIO_19,
|
||||
MICO_GPIO_20,
|
||||
MICO_GPIO_21,
|
||||
MICO_GPIO_22,
|
||||
MICO_GPIO_23,
|
||||
MICO_GPIO_24,
|
||||
MICO_GPIO_25,
|
||||
|
||||
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_1,
|
||||
MICO_PWM_2,
|
||||
MICO_PWM_3,
|
||||
MICO_PWM_4,
|
||||
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_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_FILESYS,
|
||||
MICO_PARTITION_USER_MAX
|
||||
} mico_user_partition_t;
|
||||
|
||||
|
||||
#ifdef BOOTLOADER
|
||||
#define STDIO_UART MICO_UART_1
|
||||
#define STDIO_UART_BAUDRATE (921600)
|
||||
#else
|
||||
#define STDIO_UART MICO_UART_NONE
|
||||
#define STDIO_UART_BAUDRATE (115200)
|
||||
#endif
|
||||
|
||||
#define UART_FOR_APP MICO_UART_1
|
||||
#define MFG_TEST MICO_UART_1
|
||||
#define MFG_BAUDRATE 921600
|
||||
#define CLI_UART MICO_UART_2
|
||||
|
||||
/* Components connected to external I/Os*/
|
||||
#define Standby_SEL (MICO_GPIO_NONE)
|
||||
#define MICO_RF_LED (MICO_GPIO_NONE)
|
||||
|
||||
/* I/O connection <-> Peripheral Connections */
|
||||
#define MICO_I2C_CP (MICO_I2C_1)
|
||||
|
||||
#define USE_MICO_SPI_FLASH
|
||||
|
||||
#define MICO_FLASH_FOR_PARA MICO_FLASH_SPI
|
||||
#define PARA_START_ADDRESS (uint32_t)0x00000000
|
||||
#define PARA_END_ADDRESS (uint32_t)0x00000FFF
|
||||
#define PARA_FLASH_SIZE (PARA_END_ADDRESS - PARA_START_ADDRESS + 1) /* 4k bytes*/
|
||||
|
||||
|
||||
/* Arduino extention connector */
|
||||
#define Arduino_RXD (MICO_GPIO_NONE)
|
||||
#define Arduino_TXD (MICO_GPIO_NONE)
|
||||
#define Arduino_D2 (MICO_GPIO_NONE)
|
||||
#define Arduino_D3 (MICO_GPIO_NONE)
|
||||
#define Arduino_D4 (MICO_GPIO_NONE)
|
||||
#define Arduino_D5 (MICO_GPIO_NONE)
|
||||
#define Arduino_D6 (MICO_GPIO_NONE)
|
||||
#define Arduino_D7 (MICO_GPIO_NONE)
|
||||
//
|
||||
#define Arduino_D8 (MICO_GPIO_NONE)
|
||||
#define Arduino_D9 (MICO_GPIO_NONE)
|
||||
#define Arduino_CS (MICO_GPIO_NONE)//(MICO_GPIO_12)
|
||||
#define Arduino_SI (MICO_GPIO_NONE)//(MICO_GPIO_14)
|
||||
#define Arduino_SO (MICO_GPIO_NONE)//(MICO_GPIO_13)
|
||||
#define Arduino_SCK (MICO_GPIO_NONE)//(MICO_GPIO_15)
|
||||
#define Arduino_SDA (MICO_GPIO_19)
|
||||
#define Arduino_SCL (MICO_GPIO_20)
|
||||
//
|
||||
#define Arduino_A0 (MICO_ADC_NONE)
|
||||
#define Arduino_A1 (MICO_ADC_NONE)
|
||||
#define Arduino_A2 (MICO_ADC_NONE)
|
||||
#define Arduino_A3 (MICO_ADC_NONE)
|
||||
#define Arduino_A4 (MICO_ADC_NONE)
|
||||
#define Arduino_A5 (MICO_ADC_NONE)
|
||||
//
|
||||
#define Arduino_I2C (MICO_SPI_NONE)
|
||||
#define Arduino_SPI (MICO_SPI_NONE)
|
||||
#define Arduino_UART (MICO_UART_1)
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
#define MICO_I2C_CP (Arduino_I2C)
|
||||
#include "MiCOKit_EXT/micokit_ext_def.h"
|
||||
#else
|
||||
#define MICO_I2C_CP (MICO_I2C_NONE)
|
||||
#endif //USE_MiCOKit_EXT
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
0
mico-os/board/EMW3081/platform_autoconf.h
Executable file → Normal file
0
mico-os/board/EMW3081/platform_autoconf.h
Executable file → Normal file
0
mico-os/board/EMW3081/platform_config.h
Executable file → Normal file
0
mico-os/board/EMW3081/platform_config.h
Executable file → Normal file
0
mico-os/board/EMW3081/platform_opts.h
Executable file → Normal file
0
mico-os/board/EMW3081/platform_opts.h
Executable file → Normal file
Reference in New Issue
Block a user