blob: 91453936e4361f5b68b8864acdf17ae0fe84e177 [file] [log] [blame]
//! Executables must specify their stack size by using the `stack_size!` macro.
//! It takes a single argument, the desired stack size in bytes. Example:
//! ```
//! stack_size!{0x400}
//! ```
// stack_size works by putting a symbol equal to the size of the stack in the
// .stack_buffer section. The linker script uses the .stack_buffer section to
// size the stack. flash.sh looks for the symbol by name (hence #[no_mangle]) to
// determine the size of the stack to pass to elf2tab.
#[macro_export]
macro_rules! stack_size {
{$size:expr} => {
#[no_mangle]
#[link_section = ".stack_buffer"]
pub static mut STACK_MEMORY: [u8; $size] = [0; $size];
}
}