Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify linker section for CB and buffers #58

Open
NickeZ opened this issue Jan 23, 2025 · 1 comment · May be fixed by #59
Open

Specify linker section for CB and buffers #58

NickeZ opened this issue Jan 23, 2025 · 1 comment · May be fixed by #59

Comments

@NickeZ
Copy link

NickeZ commented Jan 23, 2025

Hi,

To be able to "hand over" RTT from a bootloader to an app, I would like to specify the linker sections, so that I can place them on the same addresses in RAM. One can do that with SEGGER_RTT_SECTION and SEGGER_RTT_BUFFER_SECTION in the reference implementation.

I tested it out here NickeZ@c5e92bd and it works fine.

I use it with this addition to my linker file (before any other RAM entries):

    .rtt (NOLOAD) :
    {
        . = ALIGN(4);
        _srtt = .;
        *(.segger_rtt);
        *(.segger_rtt_buffer);
        _ertt = .;
    } > ram

Perhaps we could read those values from the environment, so that the app can specify them in the [env] section in .cargo/config.toml?

What do you think?

@NickeZ
Copy link
Author

NickeZ commented Jan 30, 2025

I tried to pass it in as an env variable / cfg. But "attribute values must be literals" means that something like #[cfg_attr(section_cb, link_section = section_cb)] is not possible to write.

I guess another option is to have optional parameters to the init_rtt macro?

I don't have much experience with macros, but something like this?

macro_rules! rtt_init {
    {
        $(up: { $($up:tt)* } )?
        $(down: { $($down:tt)* } )?
        $(section_cb: $section_cb:lit )?
        $(section_buf: $section_buf:lit )?
    } => { ... };
}

@NickeZ NickeZ linked a pull request Jan 30, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant