hallo all,

following up an earlier question (see below) I encounter the following problem: 
STM8 flash block write & erase operations need to be executed from RAM. I (hope 
I) correctly followed the below proposal by Klaus and Maarten, as well as the 
SDCC manual. However, when compiling any source file with option “--codeseg 
MYSEG“ I get this error message:

        sdcc -mstm8 --std-sdcc99 -DSTM8S207 --codeseg MYSEG -c RAM_routines.c 
-o RAM_routines.rel
        RAM_routines.asm:96: Error: <u> undefined symbol encountered during 
assembly

The respective error line in file RAM_routines.asm reads
        .area MYSEG     (CODE)

I have prepared a simple example (toggles GPIO from RAM), which is available 
under http://www.cream-tea.de/tmp/RAM_Code.zip 
<http://www.cream-tea.de/tmp/RAM_Code.zip> . For any help on this topic thanks 
a lot in advance!

PS: the SDCC version is 3.5.0, and the error occurs under MacOSX and Win7

Regards,
Georg Icking-Konert


> ------------------------------
> 
> Message: 2
> Date: Sat, 05 Apr 2014 23:09:05 +0200
> From: "Maarten Brock" <sourceforge.br...@dse.nl>
> Subject: Re: [Sdcc-user] SDCC/STM8 questions
> To: sdcc-user@lists.sourceforge.net
> Message-ID: <534070f1.13410.4135...@sourceforge.brock.dse.nl>
> Content-Type: text/plain; charset=US-ASCII
> 
>>> 4) code in RAM: actually I don?t need it for performance but to log
>>> data to the program flash, because the EEPROM is too small for my
>>> needs. To my understanding the program flash of the STM8 doesn?t
>>> support execute-while-write, so I need the actual flash write&erase
>>> routines in RAM?? At least the Cosmic compiler (and STM8 boot
>>> loader) require that. The Cosmic compiler supports that via #pragma
>>> and linker settings. Can this be done in SDCC as well and, if yes,
>>> how? A small example would be highly welcome? ;-)
>> 
>> It should be possible e.g. by having the code that goes into RAM in a
>> separate file and using the --codeseg option to sdcc and -b option to
>> the linker.
> 
> I don't think this is enough. It will be located and linked at the 
> destination address. But you probably need a copy in flash that at 
> startup is copied to ram. So you need to post-process the linked 
> object (hex-file) to move it. And then you need a routine for making 
> the copy.
> 
> Maarten
> 

------------------------------------------------------------------------------
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to