raspberrypi / pico-sdk

BSD 3-Clause "New" or "Revised" License
3.62k stars 901 forks source link

Add PICO_PANIC_NO_STRINGS_ON_TARGET option #1770

Open korneliuszo opened 1 month ago

korneliuszo commented 1 month ago

It allows in my code to remove 7kB of rodata. It's more critical on copy_to_ram configuration

peterharperuk commented 1 month ago

7kB?! Really?

kilograham commented 1 month ago

Firstly, presumably, this only affects debug builds (release builds are probably already smaller)

Secondly, i think setting PICO_PANIC_FUNCTION= (i.e. empty) will do this already

korneliuszo commented 1 month ago

@peterharperuk 7kB on basic www with picow-http @kilograham I have set(CMAKE_BUILD_TYPE "RelWithDebInfo") configured

korneliuszo commented 1 month ago

PICO_PANIC_FUNCTION ... I suspect doesn't help as it is different compilation unit (header function prototype) so it needs provide string to call even nop function

kilograham commented 1 month ago

PICO_PANIC_FUNCTION ... I suspect doesn't help as it is different compilation unit (header function prototype) so it needs provide string to call even nop function

I don't know what you mean here

Add PICO_PANIC_FUNCTION= to your target_compile_definitions in CMake

korneliuszo commented 1 month ago

I've made benchmarks

[no panic flags]$ arm-none-eabi-nm picopocket-sw.elf | grep __end__
20027e30 N __end__
[PICO_PANIC_FUNCTION=]$ arm-none-eabi-nm picopocket-sw.elf | grep __end__
20027da0 N __end__
[PICO_PANIC_NO_STRINGS_ON_TARGET]$ arm-none-eabi-nm picopocket-sw.elf | grep __end__
20025f60 N __end__