cancel
Showing results for 
Search instead for 
Did you mean: 

Basic Cube project for L476VG, works in IAR, not in TrueStudio

apullin
Associate II
Posted on September 21, 2016 at 10:37

Hi there,

I was just struggling to get a really simple bare metal project working for the L476 Discovery board. It would just not work in TrueStudio, where the startup would hang on this line:

if (HAL_UART_Init(&huart2) != HAL_OK)

As far as I can tell, the huart->gState is not being read correctly; it is reported as a value of 5 (decimal), which the comments for the typedef enum seem to indicate should not be possible.

However, if I regenerate the project for IAR, load, build, and debug, it seems to get past that line with no problem. I haven't done the printf redirection to USART2 yet (don't know how to, actually, feel free to sound off on that too), so I haven't verified if the peripheral is actually working or not. But at least execution gets through to the main loop.

So ... bug? Pretty weird. It would be great if TrueStudio worked since I like that IDE and I really don't want to have to buy IAR :\
5 REPLIES 5
Walid FTITI_O
Senior II
Posted on September 21, 2016 at 15:41

Hi pullin.andrew,

Which version of STM32cubeMx are you using ? you should share with us your .ioc file.

-Hannibal-

apullin
Associate II
Posted on September 22, 2016 at 05:00

I am using version 4.1 of STM32CubeMX and version 1.5.1 of the STM32L4 libraries.

ioc file is attached.

________________

Attachments :

stm32l476_test_proj.ioc : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtgY&d=%2Fa%2F0X0000000aVj%2FZcWyHCn22bc71pODY47I2rqDVcKlavyEe3yVnIXRuLA&asPdf=false
apullin
Associate II
Posted on September 22, 2016 at 19:46

Just as another quick follow-up, I noticed that the linker warning was emitted:

''warning: memory region `RAM' not declared'' ,

after seeing another post on the forum about how the linker script is not correctly set up for the separate RAM's.

apullin
Associate II
Posted on September 23, 2016 at 06:11

OK ... more progress.

By disabling all optimization in Atollic (-O0), the code now runs OK.

All other optimization settings (-Os, -Og, -O1, -O2, -O3, -Ofast) all produce the same failure.

Posted on October 02, 2016 at 19:18

I've run into a problem with CubeMX where the intended target is SW4STM32 (Not Atollic but both are GCC and Eclipse based).  If at any point the project is generated for EWARM, and THEN generated for SW4STM32 it will generate happily but there will be issues when running.  This may be related if you accidentally generated it for EWARM first (the default setting so it is very easy to do this) and then generated for the correct toolchain.  I would try just deleting the entire project directory and do it over being careful to ONLY generate for Atollic.

Good Luck,

Aaron