AnsweredAssumed Answered

Build ERROR.. Execution from ram [stm8s + Cosmic_C]

Question asked by SIRI.PISIT on Jul 30, 2016
I'm sorry for my bad in English.

[STVD + COSMIC_C : STM8S103K3]

I want to use prototype function
which need EXECUTION_FROM_RAM.
after i  build.. It ERROR..!!
help me please..  T_T!

// ------------------------ below.. is stm8s_flash.c (stm8s.. StdLib) -------------------------------//
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.

// ---------------------------------------------------------------------------------------------------------//

Step 1 , 2 , 4 and 5 , i make done.
but i confuse step 3..
//----------------------------------------------------------------------------------------------------//
 3- In STVD Select Project\Settings\Linker\Category "input" and in the RAM section
    add the FLASH_CODE segment with "-ic" options

//----------------------------------------------------------------------------------------------------//
[url=http://www.uppic.org/share-479C_579BEACC.html][img]http://www.uppic.org/image-479C_579BEACC.jpg[/img][/url]

when build..
//------------------------------------------------------------------------------------------------------//
clnk -l"C:\Program Files\COSMIC\FSE_Compilers\Lib"  -o Debug\stm8s103.sm8 -mDebug\stm8s103.map Debug\stm8s103.lkf 
#error clnk Debug\stm8s103.lkf:1 segment .FLASH_CODE size overflow (161)
 The command: "clnk -l"C:\Program Files\COSMIC\FSE_Compilers\Lib"  -o Debug\stm8s103.sm8 -mDebug\stm8s103.map Debug\stm8s103.lkf " has failed, the returned value is: 1
exit code=1.
stm8s103.elf - 3 error(s), 0 warning(s)

//------------------------------------------------------------------------------------------------------//

How do i solve this problem..?

Attachments

Outcomes