Skip to content

Commit

Permalink
shell: change XFA format for !20958
Browse files Browse the repository at this point in the history
  • Loading branch information
maribu committed Nov 7, 2024
1 parent b531cc9 commit b8eaa41
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,17 @@ macro_rules! static_command {
// thus static, and the_function is static by construction as well)
unsafe impl Sync for StaticCommand {}

// Starting with https://github.com/RIOT-OS/RIOT/pull/20958 shell commands will be an
// array of the struct
#[link_section = ".roxfa.shell_commands_xfa_v2.5"]
#[export_name = concat!("shell_commands_xfa_v2_5_", stringify!($modname))]
static THE_STRUCT: StaticCommand = StaticCommand($crate::riot_sys::shell_command_t {
name: $crate::cstr::cstr!($name).as_ptr() as _,
desc: $crate::cstr::cstr!($descr).as_ptr() as _,
handler: Some(the_function),
});
// Before https://github.com/RIOT-OS/RIOT/pull/20958 shell commands was an array of
// pointers. We provide both and let the linker perform garbage collection.
#[link_section = ".roxfa.shell_commands_xfa.5"]
#[export_name = concat!("shell_commands_xfa_5_", stringify!($modname))]
static THE_POINTER: &StaticCommand = &THE_STRUCT;
Expand Down

0 comments on commit b8eaa41

Please sign in to comment.