On 02.10.2015 18:58, Georg Icking-Konert wrote: > hello all, > > may I bother you again with a question about how to execute code in the > RAM of STM8…? > > For routines in RAM (as mandatory for STM8 flash block write/erase), I > understand the steps are: > > 1. compile & link routine for address in RAM —> > /works now using #pragma in C code and —codeseg for linker (see > [bugs:#2421]; thanks to Ben Shi!) > > / > 2. tell linker to reserve flash space for above RAM routine (required > for step 3) —> > /I implemented an unused routine which contains N _nop_ > operations. But isn’t there an easier way, e.g. "const > code byte buf[N]“ or so…? > > / > 3. modify hexfile to move RAM code to flash address, so after upload > and reset a copy of the RAM routine is in flash —> > /haven’t done that yet. I have to look into srecord like Maarten > proposed below > > / > 4. during STM8 initialization copy routine from flash to RAM. > Specifically, get src, dst and length, and copy to RAM —> > /under http://www.cream-tea.de/tmp/main.c please find a file > where I try to do this in assembler, because linker labels are only > accessible via assembler…? This is my first "real“ assembler code, > so I’m not quite sure it’ll do the job. Would you please be so kind > and have a look at it? > > / > 5. when required call RAM routine by name from C > /this should work, since the linker label still points to RAM…?/ > > > Can you please check if my understanding is correct? For your help > thanks a lot in advance and have a nice day! > > Regards, Georg
The list looks ok to me. Your asm seems correct, but somewhat inefficient. Philipp
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------
_______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user