On Fri, 2 Oct 2015 18:58:20 +0200
Georg Icking-Konert <ick...@onlinehome.de> 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:
> 
> 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!)
> 
> 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…?

It's not entirely pretty but for similar things I do the following
fairly portable sequence:

        link the program for RAM
        turn the binary code block into C format hex with a tool like xd
        and then do

        const uint8_t download[] = {
        #include "downloader.hex"
        };

then just memcpy it into place

and you can have the Makefile do all the steps as needed in the right
order.

Alan

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

Reply via email to