stm8L,想块读写或擦除操作,但需要把这些程序移到RAM中执行,下面是flash。c的注释!请哪位会的教一些
具体怎么做?
1- Define a segment FLASH_CODE by the mean of " #pragma section (FLASH_CODE)".
This segment is defined in the stm8l15x_flash.c file.
2- Uncomment the "#define RAM_EXECUTION (1)" line in the stm8l15x.h file,
or define it in Cosmic compiler preprocessor to enable the FLASH_CODE segment
definition.
3- In STVD Select Project\Settings\Linker\Category "input" and in the RAM section
add the FLASH_CODE segment with "-ic" options.
4- In main.c file call the _fctcpy() function with first segment character as
parameter "_fctcpy('F');" to load the declared moveable code segment
(FLASH_CODE) in RAM before execution.
5- By default the _fctcpy function is packaged in the Cosmic machine library,
so the function prototype "int _fctcopy(char name);" must be added in main.c
file. |