cancel
Showing results for 
Search instead for 
Did you mean: 

Compiler not working

freya17365
Associate II
Posted on May 13, 2016 at 12:56

Hi to all,

I am using Keil and it works fine, but I would like to try STM32F4xx series, so I would like to change compiler.

I tried both EmIDE and CooCox, but I am not able to obatin a working executable.

I realized a working program on Keil (a simple led blinker) and it works.

The same code on the other two compilers doesnt'work.

Here is what I got after compilation:

Keil: Code=976 RO-data=216 RW-data=12 ZI-data=1636

EmIDE: Output size is 8.62 KB

CooCox: Text=1868 Data=1084 BSS=36 Dec=2988

Does someone use EmIDE or CooCox?

How do you configure them?

Is it a GCC problem?

Thank you

Freya

21 REPLIES 21
Posted on June 17, 2016 at 20:00

Attached are the files I built from the project last month

What are you using to flash the files? Have you considered investing in a debug-pod?

You mentioned an F4 originally but the code was for an F0 (STM32F072?). Any specific board we might be familiar with? DISCO?

________________

Attachments :

demo.hex : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hti4&d=%2Fa%2F0X0000000aW2%2FxHybp1yUjsxEUs0sDxfHAkbMRYTRoRomSKoaR0EYPd4&asPdf=false

demo.map : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtdL&d=%2Fa%2F0X0000000aSA%2F.9rhZUSUtgGaVW0yXw4zAPYzdO_C8AerjSdOpGpP7ac&asPdf=false

flat.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtMO&d=%2Fa%2F0X0000000aP2%2FUcx_rpzOt5XljdHey_qcYtW8DSJy9ZJnyqUruVCF4QM&asPdf=false
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
freya17365
Associate II
Posted on June 20, 2016 at 22:51

I experience always big problems in login, but today I am succesfull, so I can answer :)

I tried files you compiled, but also them would not work.

I used an STM32F030K6 (32 pin LQFP) for my board and I am using FlashLoaderDemonstrator to transfer files.

I use also a STM32F0308-DISCO board for comparison, but I have not yet understood how to use it for debugging (IDEs I used did not recognized it)

I annex files for the DISCO version.

Now I am trying to write startup code in C instead of assembler hoping to reduce fault causes.

If I understood well, all code is loaded in flash memory starting from address 0x00000000 (in order: isr_vectors, code, data, bss).

Then starts Reset_Handler routine that copy data from flash to ram and, at last jump to SystemInit() and main().

Probably this will be a blind alley, but I have nothing to lose in trying.

I would like also to debug my code line by line, but I have not yet understood how.

Freya

________________

Attachments :

Src.7z : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HteE&d=%2Fa%2F0X0000000aSD%2FQ02MQJhUBbkfBNKVii8wZC670Sg0ilquIsgC3S5M8cs&asPdf=false
Posted on June 21, 2016 at 05:26

Your startup code is not calling the constructors.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
freya17365
Associate II
Posted on June 21, 2016 at 21:11

Hi,

you are right, now I corrected both startup.s and startup.c, but result is always the same.

Checking .map file I noted differences in .isr_vectors between .map file and .hex file.

For example

Reset_handler: .map -> 0x0800040c .hex -> 08001DD9

SysTick_Handler: .map -> 0x08000224 .hex -> 080003D1

Is it right?

________________

Attachments :

gcc.7z : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzM7&d=%2Fa%2F0X0000000bNH%2FK63_URHOUwJJzi7KHzueHH8n1JUVENx7NzsW73eCpow&asPdf=false
Posted on June 21, 2016 at 22:38

I had built a version for the DISCO, and run the LED init code explicitly, and the main loop had them flashing alternately.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
freya17365
Associate II
Posted on June 22, 2016 at 08:46

Hi Clive,

I tried the disco version and it worked fine.

Please, could you tell me  which startup file and which gcc version did you use?

I suppose you ran the bat.bat file included in the zip file.

Did you make some changes?

Thnak you

Freya

Posted on June 22, 2016 at 19:08

I'm using GNU/GCC 4.9, a flat file structure and a makefile. Building your original code, cleaned up a bit so I can build for GPIOA vs GPIOC, and explicitly initializing the LED.

Sorry not much of a CPP fan, but was apparent constructors/ctors stuff wasn't getting done.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
freya17365
Associate II
Posted on June 22, 2016 at 21:58

I'm using version 5.3. I'll try with another gcc version.

What do you mean with: ''was apparent constructors/ctors stuff wasn't getting done.''?

Do I have to cut some sections?

Now I'll try and post when I'll get results.

Thank you

Freya

AvaTar
Lead
Posted on June 23, 2016 at 07:07

> I'm using version 5.3. I'll try with another gcc version.

 

> What do you mean with: ''was apparent constructors/ctors stuff wasn't getting done.''?

 

For C++, the startup code additionally calls all constructors for class objects (not created by 'new') before it jumps to main. That happens right after stack setup and memory initialization. Thus, you need a special startup code for C++ programs, the 'standard' C startup will not do. Changing the gcc version is probably not going to help.