Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


How to make a Release configuration? SOLVED.

Most IDEs create Debug and Release confugurations during creating a project. And usually Debug configuration works fine as standalone app, i.e. without connecting to a PC. May be not as effective as it supposed to, but works. Sometimes Release config does not necause of too smart compaler that optimizes too much :-)

Ac6, unfortunatelly, neither creates two configurations, nor makes a file that can run Debug config in standalone mode. And it casues a big trouble - you write, debug a project, it works, you like it and suddenly... oops!!!

I even tried to do it on Nucleo board with simple GPIO toggling provided by STM. The project compiled, downloaded into the board and ran. However, if you disconnect the board from the IDE/PC and connect it again to PC nothing happens.
The only difference between Nucleo board and my own board - while the Nucleo board connected to PC/IDE you can run it by hitting “Run” button (not only “Debug”) and restart the program by pressing reset button on board. My own board can’t do it frown

I hope Ac6 guys, at least, can help to build Release configuration here before the new version of the IDE be available.

I understand, that Linux gurus can find this problem ridiculous :-), but for people switched from IAR and other IDEs it is a big problem.
Please, help!!!

Hi,

About the standalone debug, we didn’t have developed it yet but we are looking on how to do it.

For the Release configuration :
Did you create your project from System Workbench or did you import it ?

In the first case, in the Project Properties > C/C++ Build, you have a configuration combo box to display your current configuration. A Release configuration with the correct optimisation and debugging level should editable here (don”t forget to set it active in “Manage Configuration” to use it)

Release Config

If there is no Release configuration choice, in the “Manage Configuration” dialog, create a new configuration from the Debug one. Then set it active and modify the optimisation and debugging level options in C/C++ Build > Settings

Hope I did answer your problem.

Kevin
Ac6


Hi Kevin,
I imported the project. For the Nucleo board from the STM FW package. For my board - from Cube MX.
Neither one has the release configuration - I checked both.

I tried to create the Release config, but got a lot of errors about non existing files. Basically need to set all directories and settings correct, but there are so many parameters...

Could you propose the simplest way to create the Release config with some kind of “standard” set of options? Similar to the “standard” set of options that you provide for the Debug config.


Kevin,
Could you tell the main difference in Debug and Release confugurations?


Tunisia

Hello Chudik,

Usally,
In Debug Configuration we set:

  • The Debug Level to Maximum (-g3)
  • The Optimization to Optimize for Debug (-Og)


In Release Configuration we set

  • The Debug Level to None
  • The Optimization to -Os or -O1 ... (depends on your needs)


For more informations on:


Best Regards,
Tarek


Hmm.. Interesting
With example project I was able to run it in standalone mode with just choosing “...data in their own section” option (-ffdata-sections) in addition to already existing (-ffinction-sections). However, it does not work for my project.

I was trying to make Release configutation based on Release default - so much trouble with no luck...


Started from real scratch. Well... almost. :-) Used the CubeMX to create a very simple project for my board that just toggles a pin. And got as same behaviour as my other project. It works only in debug mode, not standalone. It does not react on reset either.

So, what is the big difference between example projects by STM and CubeMX projects from the same authors that does not allow to run an application in standalone mode?

Seems like the difference in the boot code that runs before going to main, not in compilator configuration. Could anybody help with that? Probably need to take a look to the boot assembler code.


Tunisia

Hello Chudik,

I cannot reproduce,
I have created a basic project with CubeMX toggling a simple LED,
then I have added a Release Configuration based on Debug Configuration (to not miss any crucial setting),
then I have set the release configuration as Active, then modified the Debug Level to None and Optimization to -Osize and It works

I the problem persists try the following:
In the same Debug Configuration modify the optimization and you can leave debug level as maximum since this does not impact the binary (this only inmpacts the informations (sympbols) stored within the ELF file)

Regards,
TarekB


Hello Tarek,
Checked on the Nucleo Board. There is no such problem at all. Just created project with Cube MX, compiled, downloaded and ran. Reset button resets the program and it starts again. With connecting to the USB port without using debugger it works without using debugger as well. Don’t even need Release configuration

Update: as soon as I disconnected internal debug interface on the Nucleo board form the µC (opened CN2), it started to behave the same way, i.e. does not start upon power on.

Did you try your basic project on the same/similar or on your own board?


Me again :-)
After discovering that after opening CN2 the Cube MX generated project won’t run in ether confugartion I returned to the STM examples again.
Compiled STM example, created Release, downloaded to the chip. The same story: with closed CN2 the program runs, with opened CN2 - does not.

I connected scope to the CN2 pins and found that when USB cable is connected, the chip in the interface part of the board sends some information: there is SWCLK and SWDIO. Definetly, when the CN2 is open there is no connection and target µC does not do anything.

So, where is the problem? In GCC itself, or in GCC options, or .... question

Tunisia

It can be related to your ST-Link V2-1 Firmware version, could you please identify the version embedded on your nucleo ?
(you can read it form ST-Link Utility log or from openocd console ...)


I’m not sure how it can help
ST-LINK Firmware version : V2J23M9
That is for the ST-Link on Nucleo board.


Tried to download the BIN file of this simple project for both Debug and Release versions with this utility - they behave the same way.

Got it working!!!
The problem is in the Nucleo board. With using power from the board USB the target µC requires some kind of starting sequence from the interface chip. With using external power pins that sequence is not required. The project starts right away. Actually no need for the Release configuration to work in standalone mode.


Tunisia

Could you please try to upgrade your ST-Link Firmware version (to V2J25M14) using this http://www.st.com/web/en/catalog/tools/PF260217Question
And verify if that works.

Update:
I have the same behaviour using V2J24M10 but when using the newest version (which is the case for me) the problem disappears

Update2:
If you are using an USB chager as power source (on CN1), even with the last firmware available on web (V2J25M14), this will not work : The MCU is held under reset.
In this case you can workarround the problem by powerering the board using E5V (external power) pin.
This problem will be fixed in next ST-Link Firmware version.

Best Regards,
Tarek BOUCHKATI
STMicroelectronics

you are using an USB chager
Yes, I had such problem with my previous project that is postponed for right now.
Good to hear, that it was not my problem :-) and gonna be fixed.


Upgraded firmware. Yes, on Nucleo Board it works.

Is this the same for the standalone ST-Link adapter? It also got a new version of firmware


Tunisia

>> Upgraded firmware. Yes, on Nucleo Board it works.
Good to hear that :-)

>> Is this the same for the standalone ST-Link adapter?
No, Standalone ST-Link V2 does not use this kind of starting sequence so it is not concerned by this problem,
this is specific to mbed enabled boards (which embeds ST-Link V2-1) ie. all Nucleo boards and some new discovery and eval boards

>> It also got a new version of firmware
Yes you can use the same upgrade executable to update your standalone ST-Link to V2J25S4


Hmm, apparently changing firmware in the standalone adapter ST-Link V2 also helped. My board is able to been reset and work standalone without the adapter connected.

Something goes wrong. My custom board would not start in standaline mode again frown

Yes, of course. I can download, go by steps, run... Until I press hardware reset button or switch off/on power.

Tunisia

Is your custom board powerd through ST-Link ?

If yes, are you using the latest ST-Link FW (could be V2J26M15, V2J26S4 or V2J26S0 // since i don’t know which ST-Link HW you are using)?

If not, this could be related to various causes (BOOT pins, you are executing from RAM .... )

Is your custom board powerd through ST-Link ?
No, It uses power from USB (USB interface of the chip not used)

i don’t know which ST-Link HW you are using)
ST-LINK/V2 by STM
Firnware version: V2.J25.S4

STM32 ST-LINK Utility suggest to update to the same version as well as STLinkUpgrade

BOOT connected to ground thriugh 1M (tried to make it smaller - did not chane anything)
Running from the location where the AC6 loads the program by default.


Updated firmware to 2.26. Did not help.
Tunisia

Hi Chudik,

I have tried to reproduce the issue but in vain cry

Is your application running from RAM ?
>> if so you need to change your boot pin(s) connection(s)
>> else could you monitor the NRST pin level via Oscilo or simple voltmeter ?

Update
any way, you can launch your application in standalone mode, then try to connect to your mcu without reset (hotplug mode) using st-link utility, then read your program counter register. That will give an idea of what is going.


Page: 1/2  [Next]
1  2 
 

Newest Forum Posts

  1. Монтаж камина с грилем в Москве - установка и барбекю by KpddomErorb, 2025-05-10 18:28
  2. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  9. Build a project in "release" mode by tang, 2025-02-20 10:36
  10. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35

Last-Modified Blogs