Add debug-friendly code optimization option to boards.txt

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
User_UMjT7KxnxP8YN8
 
Posts: 323
Joined: Tue Jul 17, 2018 1:28 pm

Add debug-friendly code optimization option to boards.txt

Post by User_UMjT7KxnxP8YN8 »

I'm sure if you've used a debugger with any of Adafruit's Cortex-M4 products you've noticed how excellent and creative the gcc code optimizer can be. While it may produce fast and compact machine code, it can be difficult to follow when stepping through in a debugger.

I looked at the available gcc optimization settings recently and noticed there's one that's said to "optimize the debugging experience". Unfortunately, it isn't included in boards.txt for any Adafruit's products. So I added it to my boards.txt for several Adafruit M4-based products that I use (but not all of them; I had no idea there were so many). Note that this feature will work for ANY processor, not just the M4

The modification involved adding two lines for each board that I changed. These lines should be grouped with similar lines under the options for each processor that you modify, Note that the prefix at the beginning of the line must be changed for each board.

Here's an example for the Metro M4 Express:

Code: Select all

adafruit_metro_m4.menu.opt.noOpt=NoOptimize (-Og) debugging
adafruit_metro_m4.menu.opt.noOpt.build.flags.optimize=-Og
and another for the Grand Central:

Code: Select all

adafruit_grandcentral_m4.menu.opt.noOpt=NoOptimize (-Og) debugging
adafruit_grandcentral_m4.menu.opt.noOpt.build.flags.optimize=-Og
I've only made these mods for boards I use, but Adafruit may want to consider including them in all future board package updates.

My modified boards.txt is attached to this post. You can use it in Windows by copying it to C:\Users\[yourWindowsUsernameHere]\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.3 and restarting the Arduino IDE.
Attachments
boards.txt
(103.42 KiB) Downloaded 6 times

User avatar
adafruit2
 
Posts: 22144
Joined: Fri Mar 11, 2005 7:36 pm

Re: Add debug-friendly code optimization option to boards.tx

Post by adafruit2 »

hihi the best way to get this out for people to use is to submit a PR against our github repo!
https://learn.adafruit.com/contribute-t ... and-github

User avatar
User_UMjT7KxnxP8YN8
 
Posts: 323
Joined: Tue Jul 17, 2018 1:28 pm

Re: Add debug-friendly code optimization option to boards.tx

Post by User_UMjT7KxnxP8YN8 »

The problem with that is that I didn't add the option for every board, which is what needs to be done. I only added it for the boards I'm using at the moment.

My suggestion is that it would be useful if Adafruit were to do it across the board.

Locked
Please be positive and constructive with your questions and comments.

Return to “Metro, Metro Express, and Grand Central Boards”