Electoday 2025

ไมโครคอนโทรลเลอร์ => Other MCUs => Topic started by: TaoTao on July 27, 2016, 07:06:26 PM

Title: STVD(STM8S103) ใครเคย EXECUTE from RAM ผ่าน บ้างน่ะครับ
Post by: TaoTao on July 27, 2016, 07:06:26 PM
STVD(STM8S103) + Cosmic_C ครับ
คือ กำลังจะใช้ Prototype func ของเค้า
ซึ่งต้อง Execute from RAM

ทำตามทุกขั้นตอนแล้ว แต่ผม Build ไม่ผ่าน

มันขึ้น FLASH_CODE Size Overflow งง หนักมาก @_@!
น่าจะผิดพลาดที่ ขั้นตอน 3 เปล่าหว่า

ใครลองทำตาม แล้ว work บ้างครับ

นี่คือส่วนหนึ่ง ใน ไฟล์ stm8s_flash.c
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.


ลูกศรชี้ คือ ที่ผมเพิ่มขึ้นมา
ไม่รู้ทำผิดหรือเปล่า จากคำแนะนำ ข้อ 3 ของข้างต้น
(https://s32.postimg.org/4zemo8qn5/Execute_RAM_01.png) (https://postimg.org/image/4zemo8qn5/)

เมื่อ Build แล้ว เป็นแบบนี้

----------- Project stm8s103 - STM8 Cosmic - Configuration Debug -------------

Running Linker
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 (1150)
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)

มันเป็นเพราะ อะไร อ่ะครับ
ขอบคุณล่วงหน้าครับ
@_@!