How to download firmware/bootloader to custom boards with STM32F479NIH6 and debug?

Discussions concerning TrueSTUDIO for STM32 9.0.0 and later versions.

Moderators: Markus Girdland, Mattias Norlander

kostak
Posts: 4
Joined: Wed Sep 25, 2019 7:32 pm

How to download firmware/bootloader to custom boards with STM32F479NIH6 and debug?

Postby kostak » Thu Sep 26, 2019 4:36 pm

TL:DR; New to firmware development. Inherited codebase for new revision of product. Sole firmware developer. Cannot step through code. Seeking advice.
---------------------
So I am fairly new to firmware development in a new company where I inherited this codebase that is to be used for a new product. Previously, TrueStudio 9.x.y was used for the previous generation product last year.

I am the sole firmware developer in a small company. I had 2 weeks with the previous firmware engineer before they left. They did their best to transfer as much knowledge as possible, but not everything could be covered in that time-frame. My background is Cypress FX3 firmware development and kernel device drivers.

The codebase seems to have bootloader and application code mixed together. First, is this a common practice, as I see these as separate functions. The bootloader, per my understanding, is to configure the STM32 to load and run the application.

I build the application and bootloader, and when I attempt to download/debug the bootloader with a breakpoint set immediately in main,

TrueStudio 9.3.0 with an ST-Link v2 is used to connect to the custom board. I am building a debug/non-optimized code, which I download via the ST-LinkV2. The Console window output I receive starts with the below, with the crash (?) shown afterwards.

So the question I have is, of which settings do I need to be most careful? Is there something obvious I am missing due to my lack of expertise? Given that the environment is for a shipped product that did work, should I still stick with TrueStudio, or make the change to STM32CubeIDE (I did play around to it, but saw that the conversion of the project to that new IDE is nontrivial).

And is there a way to pay for support from ST, now that TrueStudio Pro is no longer available?

Thank you for reading.
Kosta

And now the initial output:
STMicroelectronics ST-LINK GDB server. Version 5.1.0
Copyright (c) 2018, STMicroelectronics. All rights reserved.

Starting server with the following options:
Persistent Mode : Disabled
Logging Level : 1
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled

Waiting for debugger connection...
Debugger connected
-------------------------------------------------------------------
STM32CubeProgrammer v1.3.0
-------------------------------------------------------------------
Log output file: C:\Users\Kosta\AppData\Local\Temp\STM32CubeProgrammer_a04312.log
ST-LINK SN : 48FF6E064967535721350887
ST-LINK FW : V2J35S7
Voltage : 3.19V
SWD freq : 4000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x434
Device name : STM32F469xx/F467xx
Device type : MCU
Device CPU : Cortex-M4

Memory Programming ...
Opening and parsing file: C:\Users\Kosta\AppData\Local\Temp\ST-LINK_GDB_server_a04312.srec
File : C:\Users\Kosta\AppData\Local\Temp\ST-LINK_GDB_server_a04312.srec
Size : 162084 Bytes
Address : 0x08040000

Erasing memory corresponding to segment 0:
Erasing internal memory sectors [6 7]
Download in Progress:

File download complete
Time elapsed during download operation: 00:00:03.894

Verifying ...

Download verified successfully


Then after a moment I get the following output in the Console window:

Program received signal
SIGINT, Interrupt.
0x08007506 in ?? ()


Stopping the session, I see the following appended to the Console window in the first section:

Debugger connection lost.
Shutting down...

frank_ee
Posts: 103
Joined: Wed Apr 05, 2017 5:08 pm
Location: USA

Re: How to download firmware/bootloader to custom boards with STM32F479NIH6 and debug?

Postby frank_ee » Mon Sep 30, 2019 2:54 pm

Hello Kosta,

Can you try to download the application without the bootloader? Changing toolchains takes time, can you use the same version of TrueSTUDIO?

kostak
Posts: 4
Joined: Wed Sep 25, 2019 7:32 pm

Re: How to download firmware/bootloader to custom boards with STM32F479NIH6 and debug?

Postby kostak » Mon Sep 30, 2019 8:43 pm

Frank,

I unfortunately do not know how yet. I resolved this in a way where I just got a new board. I don't know how badly the "bad" board became when reprogrammed by someone else. I am also comparing the new board between my PC and that of a recently departed co-worker (my sanity check). I'm able to download and run the firmware, but on my PC I do get the following before hitting the breakpoint in main. I do not see the following on my former co-worker's PC:

Program received signal
SIGINT, Interrupt.
0x1fff5238 in ?? ()


It is some cause for concern. I uninstalled/reinstalled TrueStudio and deleted/recreated the workspaces. However, as I am now able to make progress, I'm focused on that. I do have a discover board on order that I will use to learn the tools in greater detail.

frank_ee
Posts: 103
Joined: Wed Apr 05, 2017 5:08 pm
Location: USA

Re: How to download firmware/bootloader to custom boards with STM32F479NIH6 and debug?

Postby frank_ee » Mon Sep 30, 2019 8:59 pm

Hello Kostak,

When downloading to flash, the entire flash memory is erased, the previous code will be erased. Check the linker script file to see how the flash and RAM are setup, including all sections. The error you mentioned sometimes happens and the debugger has to be restarted. Since you have confirmed it's a toolchain issue, find out exactly what version of Atollic is on the working PC. Which discovery board are you using?

kostak
Posts: 4
Joined: Wed Sep 25, 2019 7:32 pm

Re: How to download firmware/bootloader to custom boards with STM32F479NIH6 and debug?

Postby kostak » Mon Sep 30, 2019 9:27 pm

Frank,

Both PCs are running the same version of TrueStudio: 9.3.0. Both PCs are building/loading/debugging the same codebase. One of my TODOs is to use a debugger like I would for debugging a Windows driver (WinDBG). I do have a lot to learn about the tools/environment.

I ordered this board Friday, but have not received it: https://www.st.com/content/st_com/en/pr ... overy.html

frank_ee
Posts: 103
Joined: Wed Apr 05, 2017 5:08 pm
Location: USA

Re: How to download firmware/bootloader to custom boards with STM32F479NIH6 and debug?

Postby frank_ee » Fri Oct 04, 2019 5:26 pm

Hello Kostak,

I have a similar discovery board (for the STM32F411), but I use TrueSTUDIO version 9.0.0. Have you uninstalled and reinstalled version 9.3.0 on your machine?

kostak
Posts: 4
Joined: Wed Sep 25, 2019 7:32 pm

Re: How to download firmware/bootloader to custom boards with STM32F479NIH6 and debug?

Postby kostak » Fri Oct 04, 2019 5:31 pm

Frank,

Yes, I have reinstalled the app. With a new board with the same processor (STM32F479NIH6), I'm able to download the bootloader and application and have things run. It does not make sense to me how a co worker running some utility would cause a board to lose the ability to download/execute the bootloader and application. I still intend to debug this as I again expertise and tools, and I think this is important for becoming a SME. However, I have deferred this for now.

I'm still waiting to receive the Discovery board that was ordered. That I will begin experimentation immediately. I will probably use the new IDE for learning on a separate machine (laptop).

Thanks,
Kosta

frank_ee
Posts: 103
Joined: Wed Apr 05, 2017 5:08 pm
Location: USA

Re: How to download firmware/bootloader to custom boards with STM32F479NIH6 and debug?

Postby frank_ee » Fri Oct 04, 2019 5:44 pm

Hello Kostak,

Glad you figured out the problem. Keep the same extra discovery boards handy as they are inexpensive and can be replaced if one gets damaged or you need to modify board hardware.


Return to “TrueSTUDIO for STM32 discussions”

Who is online

Users browsing this forum: No registered users and 0 guests