[SOLVED] code for Nucleo G431KB does not run with binary code size > ~65140 bytes

Post here all questions related to STM32 core if you can't find a relevant section!
Post Reply
fro
Posts: 8
Joined: Tue Mar 23, 2021 8:26 am

[SOLVED] code for Nucleo G431KB does not run with binary code size > ~65140 bytes

Post by fro »

Code with binary size larger than approximately 65140 bytes does not work on Board Nucleo-32 with Board Part Number: "Nucleo G431KB". Forum search did not yield any results. I've reproduced the behaviour with Serial to make the steps to reproduce easier.

Steps to reproduce:
1. Unzip the attached g4size.ino.zip and use the uncompressed code as a sketch.
2. Configure the board/settings as on the screenshot below.
3. Upload.
4. Verify the code is not executed.
5. Remove a single character from any string printed.
6. Upload.
7. Verify the code is executed.

Environment:
- Arduino 1.8.13
- STM32 core 1.9.0
- Board: NUCLEO-G431KB
g431kb.png
g431kb.png (33.71 KiB) Viewed 2707 times
Upload logs snippet:

Code: Select all

Sketch uses 65144 bytes (49%) of program storage space. Maximum is 131072 bytes.
Global variables use 908 bytes (2%) of dynamic memory, leaving 31860 bytes for local variables. Maximum is 32768 bytes.
The attached g4size.ino.zip effectively contains a sketch like shown below, the full sketch can't be inlined because of the size limit.

Code: Select all

void setup() {
  Serial.begin(115200);
  Serial.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb1");
  Serial.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2");
  Serial.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb3");
  Serial.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4");
  Serial.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb5");
  Serial.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb6");
  Serial.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb7");
  Serial.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb8");
  Serial.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb9");
  Serial.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb10");
  // and so on to bring the binary size to more than 65144 bytes
}

void loop() {
}
Am I missing something obvious?
Attachments
g4size.ino.zip
(1.96 KiB) Downloaded 163 times
by fpiSTM » Tue Mar 23, 2021 2:02 pm
Hi @fro
Could you try to upload you binary with the STM32Cube Programmer (SWD)?
You could also try to update your STlink fw.
Go to full post
Last edited by fro on Tue Mar 23, 2021 4:01 pm, edited 1 time in total.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: code for Nucleo G431KB does not run with binary code size > ~65140 bytes

Post by fpiSTM »

Hi @fro
Could you try to upload you binary with the STM32Cube Programmer (SWD)?
You could also try to update your STlink fw.
mlundin
Posts: 94
Joined: Wed Nov 04, 2020 1:20 pm
Answers: 6
Location: Sweden

Re: code for Nucleo G431KB does not run with binary code size > ~65140 bytes

Post by mlundin »

You can also take a look at the .map in the build directory to see if anything looks strange.
fro
Posts: 8
Joined: Tue Mar 23, 2021 8:26 am

Re: code for Nucleo G431KB does not run with binary code size > ~65140 bytes

Post by fro »

Thanks @fpiSTM, STM32Cube Programmer (SWD) as upload method nicely works as expected.
fro
Posts: 8
Joined: Tue Mar 23, 2021 8:26 am

Re: code for Nucleo G431KB does not run with binary code size > ~65140 bytes

Post by fro »

mlundin wrote: Tue Mar 23, 2021 2:59 pm You can also take a look at the .map in the build directory to see if anything looks strange.
Thanks @mlundin, I'm periodically running "arm-none-eabi-nm --size-sort" on the binary but there's not much I can quickly shave off at the moment for the code I'm working on. The sketch reproducing the behaviour, attached here, won't have any surprises in .text :)
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: [SOLVED] code for Nucleo G431KB does not run with binary code size > ~65140 bytes

Post by fpiSTM »

Did you try to update the STlink fw ? This will update the mass Storage upload method and probably fix the issue you met.
fro
Posts: 8
Joined: Tue Mar 23, 2021 8:26 am

Re: [SOLVED] code for Nucleo G431KB does not run with binary code size > ~65140 bytes

Post by fro »

After updating STLink from V3J2M1 to V3J2M3 Mass Storage update method also works, thanks again @fpiSTM!
Post Reply

Return to “General discussion”