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

Add IDE debug support to platform.txt #853

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

zfields
Copy link
Contributor

@zfields zfields commented Mar 16, 2024

No description provided.

@zfields zfields changed the title Add IDE support for debug to platform.txt Add IDE debug support to platform.txt Mar 16, 2024
platform.txt Outdated Show resolved Hide resolved
platform.txt Outdated Show resolved Hide resolved
@zfields
Copy link
Contributor Author

zfields commented Mar 17, 2024

What you have described is not my experience. I have updated my file locally and restarted the Arduino IDE 2.x, and you can see the results below:

/home/zak/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-gcc -c -Wall -Wextra -Og -g3 -nostdlib @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/defines.txt @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/cflags.txt -MMD -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv5-d16 -DARDUINO=10607 -DARDUINO_PORTENTA_H7_M7 -DARDUINO_ARCH_MBED_PORTENTA -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=0 -DCM4_BINARY_START=0x08100000 -DCM4_BINARY_END=0x08200000 -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino/api/deprecated -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino/api/deprecated-avr-comp -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7 -I/home/zak/Development/Arduino/libraries/ArduinoIoTCloud/src -I/home/zak/Development/Arduino/libraries/Arduino_ConnectionHandler/src -I/home/zak/Development/Arduino/libraries/Arduino_DebugUtils/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/WiFi/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/SocketWrapper/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Ethernet/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/GSM/src -I/home/zak/Development/Arduino/libraries/ArduinoMqttClient/src -I/home/zak/Development/Arduino/libraries/Arduino_SecureElement/src -I/home/zak/Development/Arduino/libraries/ArduinoECCX08/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Wire -I/home/zak/Development/Arduino/libraries/Arduino_Portenta_OTA/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Portenta_SDCARD/src -iprefix/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/../PORTENTA_H7_M7/includes.txt -o /tmp/arduino/sketches/1BA883498A5D9CC7DF51698757F9B440/libraries/ArduinoIoTCloud/tls/bearssl/rsa_i15_modulus.c.o /home/zak/Development/Arduino/libraries/ArduinoIoTCloud/src/tls/bearssl/rsa_i15_modulus.c
/home/zak/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-gcc -c -Wall -Wextra -Og -g3 -nostdlib @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/defines.txt @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/cflags.txt -MMD -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv5-d16 -DARDUINO=10607 -DARDUINO_PORTENTA_H7_M7 -DARDUINO_ARCH_MBED_PORTENTA -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=0 -DCM4_BINARY_START=0x08100000 -DCM4_BINARY_END=0x08200000 -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino/api/deprecated -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino/api/deprecated-avr-comp -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7 -I/home/zak/Development/Arduino/libraries/ArduinoIoTCloud/src -I/home/zak/Development/Arduino/libraries/Arduino_ConnectionHandler/src -I/home/zak/Development/Arduino/libraries/Arduino_DebugUtils/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/WiFi/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/SocketWrapper/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Ethernet/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/GSM/src -I/home/zak/Development/Arduino/libraries/ArduinoMqttClient/src -I/home/zak/Development/Arduino/libraries/Arduino_SecureElement/src -I/home/zak/Development/Arduino/libraries/ArduinoECCX08/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Wire -I/home/zak/Development/Arduino/libraries/Arduino_Portenta_OTA/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Portenta_SDCARD/src -iprefix/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/../PORTENTA_H7_M7/includes.txt -o /tmp/arduino/sketches/1BA883498A5D9CC7DF51698757F9B440/libraries/ArduinoIoTCloud/tls/bearssl/rsa_i15_oaep_decrypt.c.o /home/zak/Development/Arduino/libraries/ArduinoIoTCloud/src/tls/bearssl/rsa_i15_oaep_decrypt.c
/home/zak/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-gcc -c -Wall -Wextra -Og -g3 -nostdlib @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/defines.txt @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/cflags.txt -MMD -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv5-d16 -DARDUINO=10607 -DARDUINO_PORTENTA_H7_M7 -DARDUINO_ARCH_MBED_PORTENTA -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=0 -DCM4_BINARY_START=0x08100000 -DCM4_BINARY_END=0x08200000 -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino/api/deprecated -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino/api/deprecated-avr-comp -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7 -I/home/zak/Development/Arduino/libraries/ArduinoIoTCloud/src -I/home/zak/Development/Arduino/libraries/Arduino_ConnectionHandler/src -I/home/zak/Development/Arduino/libraries/Arduino_DebugUtils/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/WiFi/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/SocketWrapper/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Ethernet/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/GSM/src -I/home/zak/Development/Arduino/libraries/ArduinoMqttClient/src -I/home/zak/Development/Arduino/libraries/Arduino_SecureElement/src -I/home/zak/Development/Arduino/libraries/ArduinoECCX08/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Wire -I/home/zak/Development/Arduino/libraries/Arduino_Portenta_OTA/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Portenta_SDCARD/src -iprefix/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/../PORTENTA_H7_M7/includes.txt -o /tmp/arduino/sketches/1BA883498A5D9CC7DF51698757F9B440/libraries/ArduinoIoTCloud/tls/bearssl/rsa_i15_oaep_encrypt.c.o /home/zak/Development/Arduino/libraries/ArduinoIoTCloud/src/tls/bearssl/rsa_i15_oaep_encrypt.c
/home/zak/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-gcc -c -Wall -Wextra -Og -g3 -nostdlib @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/defines.txt @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/cflags.txt -MMD -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv5-d16 -DARDUINO=10607 -DARDUINO_PORTENTA_H7_M7 -DARDUINO_ARCH_MBED_PORTENTA -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=0 -DCM4_BINARY_START=0x08100000 -DCM4_BINARY_END=0x08200000 -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino/api/deprecated -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino/api/deprecated-avr-comp -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7 -I/home/zak/Development/Arduino/libraries/ArduinoIoTCloud/src -I/home/zak/Development/Arduino/libraries/Arduino_ConnectionHandler/src -I/home/zak/Development/Arduino/libraries/Arduino_DebugUtils/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/WiFi/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/SocketWrapper/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Ethernet/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/GSM/src -I/home/zak/Development/Arduino/libraries/ArduinoMqttClient/src -I/home/zak/Development/Arduino/libraries/Arduino_SecureElement/src -I/home/zak/Development/Arduino/libraries/ArduinoECCX08/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Wire -I/home/zak/Development/Arduino/libraries/Arduino_Portenta_OTA/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Portenta_SDCARD/src -iprefix/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/../PORTENTA_H7_M7/includes.txt -o /tmp/arduino/sketches/1BA883498A5D9CC7DF51698757F9B440/libraries/ArduinoIoTCloud/tls/bearssl/rsa_i15_pkcs1_sign.c.o /home/zak/Development/Arduino/libraries/ArduinoIoTCloud/src/tls/bearssl/rsa_i15_pkcs1_sign.c
/home/zak/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-gcc -c -Wall -Wextra -Og -g3 -nostdlib @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/defines.txt @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/cflags.txt -MMD -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv5-d16 -DARDUINO=10607 -DARDUINO_PORTENTA_H7_M7 -DARDUINO_ARCH_MBED_PORTENTA -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=0 -DCM4_BINARY_START=0x08100000 -DCM4_BINARY_END=0x08200000 -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino/api/deprecated -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino/api/deprecated-avr-comp -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7 -I/home/zak/Development/Arduino/libraries/ArduinoIoTCloud/src -I/home/zak/Development/Arduino/libraries/Arduino_ConnectionHandler/src -I/home/zak/Development/Arduino/libraries/Arduino_DebugUtils/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/WiFi/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/SocketWrapper/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Ethernet/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/GSM/src -I/home/zak/Development/Arduino/libraries/ArduinoMqttClient/src -I/home/zak/Development/Arduino/libraries/Arduino_SecureElement/src -I/home/zak/Development/Arduino/libraries/ArduinoECCX08/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Wire -I/home/zak/Development/Arduino/libraries/Arduino_Portenta_OTA/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Portenta_SDCARD/src -iprefix/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/../PORTENTA_H7_M7/includes.txt -o /tmp/arduino/sketches/1BA883498A5D9CC7DF51698757F9B440/libraries/ArduinoIoTCloud/tls/bearssl/rsa_i15_pkcs1_vrfy.c.o /home/zak/Development/Arduino/libraries/ArduinoIoTCloud/src/tls/bearssl/rsa_i15_pkcs1_vrfy.c
/home/zak/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-gcc -c -Wall -Wextra -Og -g3 -nostdlib @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/defines.txt @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/cflags.txt -MMD -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv5-d16 -DARDUINO=10607 -DARDUINO_PORTENTA_H7_M7 -DARDUINO_ARCH_MBED_PORTENTA -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=0 -DCM4_BINARY_START=0x08100000 -DCM4_BINARY_END=0x08200000 -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino/api/deprecated -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino/api/deprecated-avr-comp -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7 -I/home/zak/Development/Arduino/libraries/ArduinoIoTCloud/src -I/home/zak/Development/Arduino/libraries/Arduino_ConnectionHandler/src -I/home/zak/Development/Arduino/libraries/Arduino_DebugUtils/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/WiFi/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/SocketWrapper/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Ethernet/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/GSM/src -I/home/zak/Development/Arduino/libraries/ArduinoMqttClient/src -I/home/zak/Development/Arduino/libraries/Arduino_SecureElement/src -I/home/zak/Development/Arduino/libraries/ArduinoECCX08/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Wire -I/home/zak/Development/Arduino/libraries/Arduino_Portenta_OTA/src -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/libraries/Portenta_SDCARD/src -iprefix/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/cores/arduino @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/../PORTENTA_H7_M7/includes.txt -o /tmp/arduino/sketches/1BA883498A5D9CC7DF51698757F9B440/libraries/ArduinoIoTCloud/tls/bearssl/rsa_i15_priv.c.o /home/zak/Development/Arduino/libraries/ArduinoIoTCloud/src/tls/bearssl/rsa_i15_priv.c

I chose six random files from my compile logs, and you can clearly see they are compiling with only -Og.

The change does not do both -Os and -Og. It only includes the one indicated by the menu options set in the Arduino IDE 2.x. For example, in the case above, I have selected Sketch > Optimize for Debugging.

I'm am working with the Portenta H7, and it is working perfectly. It sounds like the GIGA configuration has a bug.

@per1234
Copy link
Contributor

per1234 commented Mar 17, 2024

Look closely at the commands you shared. You can see the option file argument right here in the command, after the -Og flag:

@/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.1.1/variants/PORTENTA_H7_M7/cflags.txt

Note that option file contains an -Os flag:

https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html#:~:text=some%20other%20language.-,%40file,-Read%20command%2Dline

@file
Read command-line options from file. The options read are inserted in place of the original @file option.

@zfields
Copy link
Contributor Author

zfields commented Mar 17, 2024

Ahh... I see.

Okay, so the answer then is to remove -Os from the cflags.txt file, right?

I'm happy to add that to the PR.

It also looks like -Wall and -Wextra should be removed as well.

@facchinm
Copy link
Member

facchinm commented Mar 18, 2024

Hi @zfields ,
removing entries from *flags.txt is not trivial since they are autogenerated when running mbed-os-to-arduino script.
I think the most sensible approach would be to understand which flag gets accepted by gcc (the first it encounters, the last ? ) and add the -Os entry there

@per1234
Copy link
Contributor

per1234 commented Mar 18, 2024

understand which flag gets accepted by gcc (the first it encounters, the last ? ) and add the -Os entry there

It is the last:

https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#:~:text=If%20you%20use%20multiple%20%2DO%20options%2C%20with%20or%20without%20level%20numbers%2C%20the%20last%20such%20option%20is%20the%20one%20that%20is%20effective.

If you use multiple -O options, with or without level numbers, the last such option is the one that is effective.

So -Og [...] -Os is equivalent to -Os and -Os [...] -Og is equivalent to -Og.

@zfields
Copy link
Contributor Author

zfields commented Mar 18, 2024

Updated to follow suggestion. 👍

platform.txt Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

3 participants