TrampolineRTOS / trampoline

Trampoline is a static RTOS for small embedded systems. Its API is aligned with OSEK/VDX OS and AUTOSAR OS 4.2 standards.
GNU General Public License v2.0
600 stars 265 forks source link

Linking against the wrong library version newlib #70

Closed Virtex6 closed 8 months ago

Virtex6 commented 6 years ago

In build.py gcc with the option "-print-file-name=libXX" is used to get the right library libc/libgcc for linking. This command is running with the parameter -mfloat-abi=soft and -mfpu=fpv4-sp-d16, which is an invalid configuration for gcc and it is returning the default library (./arm-none-eabi/lib/libc.a). When you change the mfloat-abi to softfp the right library (./arm-none-eabi/lib/thumb/libc.a) is returned and all the functions from newlib are working properly.

This problem was detected by trying to get printf to work and getting strange behavior and bad looking disassembly while debugging it. It was reproduced with 6-2017-q1-update and 6-2017-q2-update of arm-none-eabi

Virtex6 commented 6 years ago

I think I have to revert this pull request. Or at least change it a little bit more. With the changes above it seams that the stack unwinding doesn't work anymore. My test board (STM32F4-DISCOVERY) is now restoring the stack with floating-point storage (so at least 104 Bytes) when returning from exception. I think a possible workaround could be changing the ARM_CORE_EXCEPTION_FRAME_SIZE.

I thought that

‘softfp’ allows the generation of code using hardware floating-point instructions, but still uses the soft-float calling conventions.

from the gnu arm manual means that it doesn't change anything in saving or restoring the stack. Will continue to deal with the problem.

jlbirccyn commented 8 months ago

Hello @Virtex6 Have you been able to identify and fix the problem, or is this PR obsolete?

Best regards