upload.maximum_size and upload.maximum_data_size for Teensy 4.1

noisymime

Well-known member
I've recently started using the Arduino report-size-deltas workflow on Github to automatically report on memory usage increases/decreases whenever a pull request is submitted and this works great for Teensy 3.5. For Teensy 4.1 though it can't produce a report as the upload.maximum_size and upload.maximum_data_size values are currently commented out in the boards.txt file.

I can see some reference to these being commented out back when Teensy 4.1 was introduced, but I can't find any reason for why. I'm guessing there must be something in the Teensy 4.1 build process that breaks if these are enabled? I tried uncommenting and compiling/uploading seemed to work fine.

Can these safely be uncommented or is it going to cause problems somewhere?
 
Sorry my memory is a bit foggy on this. Hopefully @PaulStoffregen or @defragster or others may remember more.

I believe they were used to print out the size information at the end of builds, and potentially cause the build to abort if the program was
too large.

The issue is that that information is those two numbers are not sufficient, so the teensy_size sketch was created, which shows and uses
additional information.

Examples of issues: There is 512K of TCM(tightly coupled memory), Both DTCM (data) and ITCM(Instruction) have 512KB memory space however they both have to fit into the 512KB of the TCM, Which is split up into 32KB chunks... The system allocates however many of these chunks that are needed for the ITCM and then gives the rest to DTCM. So the teensy_size looks at the data to figure out if you overflowed either of these.

Max program size: Two things. Did you overflow the ITCM and/or did you overflow the flash.

DMAMEM - 512kb, did you overflow this with variables marked DMAMEM?

Hope that helps.
 
Can these safely be uncommented or is it going to cause problems somewhere?

Yes and no, but it's a moot point. Yes, you can safely uncomment and no it won't cause problems.

But it will not have any effect. Teensy 4.x doesn't use Arduino's simple size report. We have a dedicated size program which knows the complexities of Teensy 4.x memory. Arduino's way just isn't up to the task, for pretty much the reasons Kurt mentioned. To change the way size is reported, you would need to edit and rebuild this program. It's open source, but it doesn't take configuration info from Arduino's boards.txt or other sources.
 
Or maybe it may have some effect? Maybe it will be a problem. It's been quite a while...

You might end up with both Arduino's simple size report and Teensy's special one. If you want only Arduino's way, you can find the special hook rule that run's teensy_size and delete it.

But Arduino's way can't really deal with the partion-able RAM1 memory in Teensy 4.
 
As p#2-4 note the 1MB of Teensy RAM is unique and non-contiguous so it doesn't usefully map to the simple Arduino presentation. Only the FLASH size changes between T_4.0, T_4.1 and T_MM.
The source for Teensy_size.exe is available - it was easy to edit and alter to get to where it is to discover and document the data as presented.

Making a custom version with would be possible if an alternate presentation was desired.
 
Thanks HEAPS for the replies guys, that's given me a good understanding of why this has been setup the way it has.

I had a flick through that source code and it looks like it's probably something I can repurpose without too much trouble. AS I'm only looking at commit to commit deltas I will be curious to see whether there is much difference between the 2 as I think that for the most part changes are all going to be within the same RAM partitions, but will see.

Thanks again for the pointers.
 
Back
Top