Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mismatched GCC version for STM32Duino #720

Closed
maxgerhardt opened this issue Aug 16, 2023 · 7 comments
Closed

Mismatched GCC version for STM32Duino #720

maxgerhardt opened this issue Aug 16, 2023 · 7 comments

Comments

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Aug 16, 2023

PlatformIO uses arm-none-eabi-gcc 10.3.1 for all STM32 +https://github.com/stm32duino/Arduino_Core_STM32/ Arduino projects

else:
self.packages["toolchain-gccarmnoneeabi"]["version"] = "~1.100301.0"
self.packages["framework-cmsis"]["version"] = "~2.50700.0"
self.packages["framework-cmsis"]["optional"] = False

however, the package declaration https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json declares that since version 2.5.0, the 12.2.1-1.2 version of the toolchain must be used.

Not doing so causes failures in e.g. the STM32FreeRTOS library beceause the older toolchain version was compiled with different Newlib library and newlib options (no _REENT_BACKWARD_BINARY_COMPAT) which shrinks down the size of struct _reent from over 1000 bytes to only 288 bytes which decreases the FreeRTOS TCB_t task control block structure accordingly. This basically means that with PlatofrmIO, each created FreeRTOS task has a signifacant higher heap memory usage and out-of-memory occurs ealier or instantly. See https://community.platformio.org/t/stm32duino-freertos-problems/35163.

@valeros
Copy link
Member

valeros commented Aug 17, 2023

Thanks for pointing it out, updated.

@maxgerhardt
Copy link
Contributor Author

Could you verify that the debugger works in this toolchain version? The user is just stuck on it here

valeros added a commit that referenced this issue Aug 17, 2023
@valeros
Copy link
Member

valeros commented Aug 17, 2023

Indeed there is a problem, GDB v12 is not able to launch a debug server in pipe mode. I reverted the toolchain update to avoid breaking already working projects. As of now I'd probably recommend switching to GCC v12 directly in platformio.ini:

[env:nucleo_f401re]
platform = ststm32
framework = arduino
board = nucleo_f401re
debug_tool = custom
platform_packages = 
   toolchain-gccarmnoneeabi @ ~1.120201.0

and launching OpenOCD in a separate process, for example

"C:/Users/YOUR_USER/.platformio/packages/tool-openocd/bin/openocd.exe" -c "tcl_port disabled; telnet_port disabled" -f "C:/Users/YOUR_USER/.platformio/packages/tool-openocd/openocd/scripts/board/st_nucleo_f4.cfg"

Although, it seems only Windows is affected.

@valeros valeros reopened this Aug 17, 2023
@maxgerhardt
Copy link
Contributor Author

Very weird thing. Maybe https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases behaves differently? :/

@valeros
Copy link
Member

valeros commented Aug 17, 2023

We use that exact packages.

@maxgerhardt
Copy link
Contributor Author

maxgerhardt commented Sep 22, 2023

I assume GCC/GDB 12.3.1 also resolve the "GDB can't start OpenOCD in pipe mode" issue?

Does this also resolve platformio/platformio-core#4741 on Linux?

@valeros
Copy link
Member

valeros commented Sep 22, 2023

I assume GCC/GDB 12.3.1 also resolve the "GDB can't start OpenOCD in pipe mode" issue?

Yes, it's shipped with GDB v13 with this issue fixed.

Does this also resolve platformio/platformio-core#4741 on Linux?

Hopefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants