最近开始学习STM8L系列的,用的是ST官方开发的STM8L-DISCOVER开发板,从ST官网下载了一些例程来学习,原来的工程因为和现在IAR版本不一致无法打开,我就自己建一个工程,添加文件发现编译之后提示
Error[Lc036]: no block or place matches the pattern "ro code section MY_RAM_FUNC in discover_functions.o"
- For IAR Compiler:
1- Define a location FLASH_CODE before each code function by the mean of
" #pragma location = "FLASH_CODE"".
This location is defined in the stm8l15x_flash.c file, and it's conditionned
by IAR_RAM_EXECUTION definifition.
2- Uncomment the "#define IAR_RAM_EXECUTION (1)" line in the stm8l15x.h file,
or define it in IAR compiler preprocessor to enable the FLASH_CODE location
definition. 3- Edit the linker file lnkstm8l15xxx.icf available under "$\IAR Systems\Embedded Workbench 6.0\stm8\config\lnkstm8l15xxx.icf" by updating the line "initialize by copy { rw, ro section .tiny.rodata };" with the the following one: "initialize by copy { rw, ro section .tiny.rodata, section FLASH_CODE};".
4- The speed optimization is required to ensure proper execution from RAM.
-> In IAR Embedded workbench IDE Select roject\Options\C/C++ Compiler\Optimizations
select speed optimization