Any Parallel in Binary Sizesf IDE for Board Created to Standard PC Binary?

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
stevestrong
Posts: 1829
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Any Parallel in Binary Sizesf IDE for Board Created to Standard PC Binary?

Post by stevestrong » Mon May 29, 2017 9:32 am

The difference is made by not whether you upload or not, but by the simple fact that you select an upload method via Arduino IDE.

So please select an upload method different from STM32DUIINO bootloader in order to make the comparison more feasible.

User avatar
RogerClark
Posts: 7482
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Any Parallel in Binary Sizesf IDE for Board Created to Standard PC Binary?

Post by RogerClark » Mon May 29, 2017 10:16 am

You don't need to actually Upload via serial

You just need to set the upload type to Serial, then compile.

If you compare Blink with different upload types, e.g generic_stm32f103c

Bootloader upload is 12548
Serial upload is 6212

i.e USB Serial takes almost half of the total file size

If you are comparing boards you also need to consider the number of peripherals offered by the board, as the PINMap array of data on the peripherals is linked into the build

So if you compare the F103T, Blink is only 6044 bytes (so 200 bytes are saved because less peripherals and GPIO need to be part of the bin)

Hence comparing binary file sizes of a small 8 bit AVR with a large 32 bit processor is bound to show that the binary to control the STM32 is a lot bigger

keypunch
Posts: 67
Joined: Tue Aug 02, 2016 2:26 am

Re: Any Parallel in Binary Sizesf IDE for Board Created to Standard PC Binary?

Post by keypunch » Mon May 29, 2017 2:59 pm

I understand the setting of serial upload will not mean I need to upload the file to the uC.

If one want to use less flash does one choose a serial upload to do so for Arduino as well as STM32duino?

Is there some way to see just the .o file size before the supporting files are linked in? That would be helpful metric as well. I suspect not when building via the Arduino IDE. I am not sure if there is a CLI command that might be able to break down the pieces.

It will be useful to know the binary size of the different ways to upload. So the suggestions and reasons for testing via serial upload are most helpful. Is there yet again a different size that would result using the STLink for Arm/Cortex boards that exist in STM32 and Arduino?

I forgot to do a compile for the Arduino Due. I will do so for same conditions as posted in the PDFs for initially and then include going forward.

It may be a few days before I do the additional tests. I have various commitments. I had short bit of time the early morning hours this morning to do these tests. I have a copy of the Arduino_STM32-master (appears to be 29 May 2017 "Latest commit 920b57a 6 hours ago"), the source file and Arduino IDE, Linux 64 bit Version 1.8.2 saved.

Can someone advise me how I save the Arduino Zero, et al tools one downloads via the Tools/Board Manager? I really like to save this so I can ensure all the same variables and hence have same results when additional tests are run and a controlled variable (i.e. upload method, library) is changed? Can I simply zip the Arduino and related directories?

Regards,

John L. Males
Toronto, Ontario
Canada
29 May 2017 10:59

ag123
Posts: 808
Joined: Thu Jul 21, 2016 4:24 pm

Re: Any Parallel in Binary Sizesf IDE for Board Created to Standard PC Binary?

Post by ag123 » Mon May 29, 2017 3:22 pm

i'm not sure if debug is on but if you turn off debug say in platforms.txt chances are that it may save a couple more bytes (probably more)

usb do take up space and there is a chance some of the other libmaple objects are linked / included because there are references to them. libmaple is 'pretty large' in terms of is overall set of features and functions.

then there may be some c++ flags which has not yet been explored e.g. --nostdlibs --specs=nano.specs -fno-exceptions -fno-rtti -fno-use-cxa-atexit -fno-threadsafe-statics etc (last 4 is probably already in platforms.txt).

the catch is if you keep trying the various compile flags e.g. --nostdlibs, chances are that you would run into compile errors and if you would still like to keep the small size objective, you may need to write codes / functions to resolve those missing codes / functions yourself.

it is probably possible to get a smaller size by keep tuning the compile variables and codes so as to include only the absolute minimum. the cost is obviously that it'd likely take quite a lot of effort / time to do that and that's for a specific sketch

http://www.stm32duino.com/viewtopic.php ... 070#p27711
victor_pv wrote:Another member of the forum created this tool to analyze the .map file:
http://danieleff.com/stm32/map_analizer/

keypunch
Posts: 67
Joined: Tue Aug 02, 2016 2:26 am

Re: Any Parallel in Binary Sizesf IDE for Board Created to Standard PC Binary?

Post by keypunch » Mon May 29, 2017 11:40 pm

I have managed to find the intermediate files that has lots of useful information as I nosed about usual and not so usual places.

I have found when one selects the Maple Mini board there is no option to choose Serial, Bootloader, STlink, et al. That would suggest there is no choice to use Serial and not USB to load the sketch.

@ag123

Thanks for the link that someone has to analyze the map files.

I will do more testing based on suggestions thus far. I will then expand the spreadsheet to include the suggestions and the additional items that are related of interest. It will likely take about day to do this. Most of the work will be in extracting and making sure the values entered in the spreadsheet are correct vs typos/transposition errors. I have a number of prior commitments in next few days. Best guess is next week I will have done and ready to post.

Regards,

John L. Males
Toronto, Ontario
Canada
29 May 2017 19:40 EDT

User avatar
RogerClark
Posts: 7482
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Any Parallel in Binary Sizesf IDE for Board Created to Standard PC Binary?

Post by RogerClark » Tue May 30, 2017 2:11 am

The Maple Mini comes pre-installed with the bootloader (unlike all the other generic boards), so I didnt confuse the newbie users by adding a load of options which they don't need.

I could add then for the Maple mini, but I don't recall anyone asking from them, and also you can select the F103C and get the same result.

keypunch
Posts: 67
Joined: Tue Aug 02, 2016 2:26 am

Re: Any Parallel in Binary Sizesf IDE for Board Created to Standard PC Binary?

Post by keypunch » Tue May 30, 2017 2:53 am

@Roger,

I was hoping I could assume the F103C result would be the same as the Maple Mini bootloader (original and STM32duino choices). Great you commented in that regard. I did not want to assume. I will still do the Maple Mini test for consistency and to compare with the F103C related result with bootloader.

My day has been very mixed up today.

The most important aspect of day has been whitewashed. I wanted to wait until I have thoughts and comments to what I did before I do another round of. The transcribe to text so can transcribe to spreadsheet is the most time consuming part of testing process; and most error prone.


Regards,

John L. Males
Toronto, Ontario
Canada
29 May 2017 22:53 EDT

User avatar
RogerClark
Posts: 7482
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Any Parallel in Binary Sizesf IDE for Board Created to Standard PC Binary?

Post by RogerClark » Tue May 30, 2017 7:12 am

Hi John

I'm not really sure what the object of the exercise is.

The bin size of Blink using Libmaple, even without Serial USB is far far bigger than on a Uno, but its like comparing chalk with cheese and saying which is the best.

If you want to compare binary sizes, with similar devices, you should compare the Arduino Due and Arduino Zero and other ARM boards with the STM32

In which case the Blink sketch


Arduino Due 22084 bytes
Arduino Zero 9408 bytes
STM32F103C 6212 bytes

So its smaller than both comparably Arduino boards

You could also try comparing it with the Teensy which is also ARM.

BTW. I also have Sandeep Mistry's nRF5 core installed, and that makes a blink sketch 2222 bytes (and thats ARM )

keypunch
Posts: 67
Joined: Tue Aug 02, 2016 2:26 am

Re: Any Parallel in Binary Sizesf IDE for Board Created to Standard PC Binary?

Post by keypunch » Tue May 30, 2017 8:08 pm

Roger,

The purpose in based on my reason I opened this topic. I opened this topic to understand how uC architecture bit width affected Flash and RAM sizing.

The purpose of the tests was to confirm my assumption an 8 bit vs 32 bit uC Flash/RAM usage difference was about a factor of 4. This would allow me to determine a few basic parameters. If code I will create exceeds the expected 32K/128K (8/32 bit). The reference being the 328P to STM32F104C8T6. It may mean maybe a 256K or 512K based uC might actually be needed, exclusive of uC processing power and battery considerations, for the special important personal project end goal design/functionality scope.

The unique important personal project has been stalled due to many variations and extensions of shipping problems of AliExpress. These AliExpress shipping problems have compounded to other significant problems I will skip. The reason for the important personal project has increased steadily and significantly in last months. I still have parts I need to find for the unique project. I now have to find alternate parts sources for that has been most time consuming and challenging. The very unexpected AliExpress issues is causing me to look at wider set of choices and/or subset of what functionality I was planning into short term and long term. This may affect choice of uC into sort and long term approach. Longer term would be work on the desired functionality that likely needs uC more capable processing, Flash/RAM, and challenging battery budget elements to be worked out that will take longer to accomplish while one or two key aspects are up and running much sooner that may need less and more available lessor uC. Included in this approach is functional growth, uC growth, and being able to grow the same code base. Time for code development/re-usability and hardware/software ecosystem are competing factors for the unique important personal project as well as urgency for some of the functionality that needed to running at least by last December.

Some surprises did occur in the couple uC I tested for Flash/RAM usage initially. This caused me to expand the number of uCs to test for Flash/RAM usage. I forgot to test the Due in that first round of tests that the Due was to be part of the 32 bit uC comparison. I was shocked how large the Due Flash/RAM was when I did a quick test yesterday. I will add the Due to the spreadsheet with tests done previously. I will add tests to the spreadsheet with Serial upload, et al as well as other interesting metrics I have been able to find from the Arduino IDE environment.

I thought I would share the results given the initial reason for my topic was to know how to predict code size for different types of uC architecture bit sizes. In the end I need to know what Flash and RAM limitations I may encounter. This leads what choices I have in development model(s), coding, and uC selection. This includes uCs used for prototyping vs what uC implemented on vs how staging desired functionality (subset and long term) design goals is accomplished.


Regards,

John L. Males
Toronto, Ontario
Canada
30 May 2017 16:08 EDT

User avatar
Rick Kimball
Posts: 1058
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Any Parallel in Binary Sizesf IDE for Board Created to Standard PC Binary?

Post by Rick Kimball » Tue May 30, 2017 8:28 pm

I thought I had suggested originally to use a Due, but i guess I had just said cortex-m3, but I did spell it out in another thread:
viewtopic.php?f=41&t=2070&p=27973&hilit ... ize#p27973
-rick

Post Reply