Steps of the execution from RAM differs from one toolchain to another: - For Cosmic Compiler: 1- Define a segment FLASH_CODE by the mean of " #pragma section (FLASH_CODE)". This segment is defined in the stm8s_flash.c file. 2- Uncomment the "#define RAM_EXECUTION (1)" line in the stm8s.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.