Why does Blink sketch take up more flash and memory on Nano 33 compared to Uno?

I’ve had an Uno for a while, and just got my Nano 33 BLE Sense recently.

I noticed that the Blink sketch takes up considerably more flash and memory on the Nano 33.

I’m guessing this is due to differences in architecture (i.e. Atmega 328p compared to Nordic nRF52840) but this difference is a lot more than I was anticipating.

Flash Usage: 76396 Bytes vs 922 Bytes
Memory Usage: 42160 Bytes vs 9 Bytes

Why does the Nano 33 need such resources to run the Blink Sketch? I plan to use this board for a control project that is resource intensive and I don’t understand why the Blink sketch needs 7% of the flash and 16% of the memory.

Edit: I actually own the Nano 33 BLE Sense, can a moderator please move this if it’s not appropriate to post here? However, I think it’s a general enough question.

The Arduino Nano 33 BLE and BLE Sense use medOS. You got a whole lot of functionality copied to your Arduino. The sketch should now grow a lot slower because all the other stuff is already there.

For instance the Nano 33 BLE handles the serial via the USB itself. So it needs code for that. On the older boards you have a separate chip for that.

The BLE and BLE Sense are the same board for the most part. There are only a few additional sensors on the Sense.

Klaus_K:
The Arduino Nano 33 BLE and BLE Sense use medOS. You got a whole lot of functionality copied to your Arduino. The sketch should now grow a lot slower because all the other stuff is already there.

For instance the Nano 33 BLE handles the serial via the USB itself. So it needs code for that. On the older boards you have a separate chip for that.

The BLE and BLE Sense are the same board for the most part. There are only a few additional sensors on the Sense.

Thanks, I think that clears things up. So mbedOS requires those resources to configure the Nano 33 BLE pretty much?

sunmisola:
So mbedOS requires those resources to configure the Nano 33 BLE pretty much?

Not just, its also code that you will/might be using. Because mbedOS comes with some additional functions to begin with it will also include more parts of the standard libraries. So, when you declare a floating point variable for the first time the code size will not increase as much as when you do that for an 8-bit Arduino.

If you want to know a bit more what is in your program have a look into the map file. Compile your code using the Verify button. Then have a look at the compiler output.

You should see a path just before the Sketch uses 76468 bytes (7%) of program storage space.

C:\Users\UserName\AppData\Local\Temp\arduino_build_123456/

Go to the folder while the IDE is still open and open the sketchName.map file in a text editor. Its a long file but shows you what has been added to your memory(object, memory location and size). There is code for timers, USB, power saving, real time kernel, mutex, semaphores, interrupts, GPIO, ...