Closed maxgerhardt closed 8 months ago
I'm also quite a bit confused on how files like pico_reflash.c
(which is compiled in every case) can do printf()
when e.g. in the OPL project environment, all STDIO functions are turned off.
pico_enable_stdio_uart(picogus 0)
pico_enable_stdio_usb(picogus 0)
pico_enable_stdio_semihosting(picogus 0)
Sorry, better documenting building is something I need to do. I use LTO which does not work out of the box with the Pico SDK, so I've patched the SDK to allow for it. If you want to compile without needing to patch the SDK, disable LTO by removing this line from CMakeLists.txt:
add_compile_options(-flto=jobserver)
I use the latest versions of the ARM GNU toolchain and Pico SDK.
Disabling stdio in that way doesn't remove stdio completely, it just makes stdout/err/in go nowhere.
I forgot that I turned all stdio off in OPL... it's been a while since I touched that part of the project. I don't remember why I did that! I do purposefully turn it off for MPU, so maybe it's just a copy-and-paste from there.
I've just confirmed that this works indeed and the .uf2 file is now built.
If LTO is necessary for the project (size or performance wise), can you push your modified Pico-SDK? It does not seem to be in https://github.com/polpo?tab=repositories&q=sdk&type=&language=&sort=.
I use the latest versions of the ARM GNU toolchain
Just to confirm, that is arm-none-eabi-gcc version 12?
I don't consider LTO really necessary. I need to do some real comparisons to see if it's of measurable benefit. I manually set most functions as inline almost everywhere anyway for performance reasons.
If you want to see what LTO does, change this line in platform.h in the Pico SDK from:
#define WRAPPER_FUNC(x) __wrap_ ## x
to
#define WRAPPER_FUNC(x) __attribute__((used)) __wrap_ ## x
Just to confirm, that is arm-none-eabi-gcc version 12?
Correct. I am using arm-none-eabi-gcc-12.3.1 currently but any version 12 will work fine.
Fixed in your GitHub action MR and improved in c475db6 - LTO is no longer enabled by default and can be enabled by adding a -DUSE_LTO
on the CMake command line.
On Windows (from installer) or Linux it's the same thing: When I download
And compile the project, it fails to find a bunch of implementation for linker-wrapped functions at the end, specifically STDIO and Math ones
__wrap_puts
__wrap_printf
__wrap_remainder
Full log in https://github.com/maxgerhardt/picogus/actions/runs/6447661204
Which version of the SDK and compiler etc. are you using to build this project? The Wiki and README does not mention it.