Skip to main content
LRPS_92
Associate III
October 30, 2017
Question

Same Set of Code build with different Compiler not working in stm32l053 controllers

  • October 30, 2017
  • 15 replies
  • 2893 views
Posted on October 30, 2017 at 14:53

Hi,

I've finished building same code for a stm32l053R8 low power project using both IDE's Keil Microvision 5 & Atollic truestudio v5.5.2. Keil MicroVision project build works fine in all of our boards which we designed for the project. But Atollic build not working in some of our boards.

By switching the power, controllers flashed with keil microvision project .bin are starting from the main easily at the first attempt itself.

But, Atollic build .bin file is not getting into the main at the first attempt( requires NRST from debugger manually to reset properly & start from the main code). I've tried debugging using Atollic IDE, but it works fine, the code jumps to the main. Without debugger connected the codedoesn'trun.

What may be the reason for this kind of behaviour in controllers.?

Thanks in advance

#boot #stm32l053

Note: this post was migrated and contained many threaded conversations, some content may be missing.
This topic has been closed for replies.

15 replies

AvaTar
Senior III
October 30, 2017
Posted on October 30, 2017 at 15:15

I've tried debugging using Atollic IDE, but it works fine, the code jumps to the main. Without debugger connected the code doesn't run.

Dunno the Atollic IDE in detail.

My preferred IDE (Crossworks / ARM) uses a special startup code in the debug configuration, that waits in an endless loop for the debugger to connect.

I suggest to check if the Atollic Debug setup does the same.

Tesla DeLorean
Guru
October 30, 2017
Posted on October 30, 2017 at 16:10

Iteration bounded loops in clock startup code? Ends up in error handler or hard fault handler in a while(1) loop?

Instrument code so you understand where it is stuck, or how far it got. Use GPIO or USART initialized right in Reset Handler. Add check points so you can evaluate without a debugger.

Check for dumb things in the linker scripts, like setting stack pointer to an odd address, ie initialsp = 0x20001FFF, the CM0 hates unaligned reads.

Assuming a custom board, look at how supplies ramp, and if you need a better POR circuit to clamp device in reset for longer, or until supplies get higher, ie >100ms

Make sure BOOT0 is pulled low in your design.

Keil is a better tool, doesn't use GNU/GCC compiler, free for ST CM0 parts.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
LRPS_92
LRPS_92Author
Associate III
October 31, 2017
Posted on October 31, 2017 at 10:00

Hi,

1. I'm not using any iteration bounded clock startup code.

2. Linker Script (.ld) looks fine too from what i've seen, attached it for your consideration.

3. Using 3.6 V to power up the board, NRST is pulled high with 10 KOhms resistor & 0.1 microFarad Connected to ground in our custom board ( Which is around 1 ms? ). Crosschecked working & not working boards,all the boards do have the same hardware setup.Used 2.2 microFard & 100K resistor combination on NRST pin also ( which is around 220ms), no change in result.

4. BOOT0 is always grounded with 510 Ohms resistor.

Will check & post whether the reset_handler called before entering main by initializing GPIO's / USART.

________________

Attachments :

STM32L053R8_FLASH.ld.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hy9i&d=%2Fa%2F0X0000000b6D%2Fj2xgTyoGmCkMR6rT4nRucxTfqbHufUDthxIYKg0nZog&asPdf=false
Tesla DeLorean
Guru
October 31, 2017
Posted on October 31, 2017 at 14:57

>> I'm not using any iteration bounded clock startup code.

The Cube code has some of these, you should also look at what SystemInit() is doing.

>>

Linker Script (.ld) looks fine too from what i've seen, attached it for your consideration.

/* Highest address of the user mode stack */

_estack = 0x20002000; /* end of RAM */

That looks fine.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
AvaTar
Senior III
October 31, 2017
Posted on October 31, 2017 at 08:10

I would check as well if the Atollic project contains the proper linker script for your exact MCU variant.

Invalid address range would have the observed result.

LRPS_92
LRPS_92Author
Associate III
October 31, 2017
Posted on October 31, 2017 at 10:14

Hi,

          I've generated the pheripheral drivers, startup file & linker script using MX Cube for the Atollic project. Same controller part number used to generate code.

AvaTar
Senior III
October 31, 2017
Posted on October 31, 2017 at 10:24

Like other here, I do not speak Cube.

In your initial post, you said:

Without debugger connected the code doesn't run.

How is this statement qualified ?

The code may crash after entering main.

If you need to pursue this issue, you can instrument your code, and watch the outputs.

Maybe an UART, but even a simple GPIO will do.