Skip to main content
Visitor II
October 9, 2019
Question

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

  • October 9, 2019
  • 3 replies
  • 2617 views

Hello everyone,

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

Thanks in advance.

    This topic has been closed for replies.

    3 replies

    Visitor II
    October 18, 2019

    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/

    Visitor II
    October 23, 2019

    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.

    Visitor II
    October 18, 2019

    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.

    Visitor II
    October 25, 2019

    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.