cancel
Showing results for 
Search instead for 
Did you mean: 

How to create Run-in-RAM code using SDCC?

Vyacheslav Azarov
Associate III

Hello everyone,

Is it possible to create Run-in-RAM code using SDCC? If possible then how to do this?

Thanks in advance.

4 REPLIES 4
Philipp Krause
Senior II

SDCC deson't have direct support for this yet. However, there are some ways this can be done using code and ram section options, then copying the function to RAM manually (e.g. using memcpy()).

Here's an example of one way to do this (it uses a custom copy function instead of memcpy()):

https://lujji.github.io/blog/executing-code-from-ram-on-stm8/

Vyacheslav Azarov
Associate III

Very thanks. Copying a segment is not a problem. The problem is to create it correctly. I did not find in the SDCC documentation the possibility of creating relocatable code. Is it possible? This would greatly simplify the design processes. In the given in the attachment example the call pointers are absolute. STM8L15x have very attractive characteristics of ULP run. I would like to do something using free tools.

I understand. There is no way to do this using SDCC without external tools. In any case, is possible resort to editing the code in assembler and linking the program code manually, through explicit indication of sections locations. Thanks.

Vyacheslav Azarov
Associate III

In my opinion, the best solution to this problem was proposed by Philipp Krause in Sourceforge. https://sourceforge.net/p/sdcc/discussion/1864/thread/01c26712ef/#2044/d050/c5a5 I think the question is settled. Thanks again.