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
Radosław
Senior II
Posted on May 13, 2016 at 14:49

>> Is it a GCC problem?

This is human problem.  GCC create code not bigger than any other compiler.

Consider AC6 for startup.

freya17365
Associate II
Posted on May 13, 2016 at 16:50

>> This is human problem.

I hope so, but human is not able to solve the problem, this is why she looks for help.

I annex the code for each compiler hoping it could be useful.

I tried also AC6, but when I tried to compile, it was returned an error because AC6 did not found ''LEDClass.h'' that was in the same directory (and was also in the project) of ''LEDClass.h'' tath used it.

Is it possible to check which function compiler add to the executable?

Maybe I have to change gcc commands? In this case, what do I need?

Anyway I have no problem in using anything. The only requirement is that it is free and with no size or mcu limits.

Thank you

Freya

________________

Attachments :

CompilerComparison.7z : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htha&d=%2Fa%2F0X0000000aVv%2FDAbjNHTMdNmT5g6FbFZ4eGnjatUYm2eqH7EbgDCvOh0&asPdf=false
Posted on May 13, 2016 at 17:55

Might delve later, but the linker outputs stats when it finishes, and provide a .MAP file that can be reviewed.

Keil's linker is good at dead code elimination both at the user and library level. You'd want to look at how things are built, and look for the output with a ''function as an object'' type settings so that code within a file can actually be separated into smaller pieces. The finer the granularity, the easier the linker's job is to identify use patterns and real dependencies.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Radosław
Senior II
Posted on May 13, 2016 at 19:23

>>it was returned an error because AC6 did not found ''LEDClass.h''

Add folder to include search paths.

Posted on May 13, 2016 at 21:47

Built your EmIDE Cortex-M0 directly in GNU/GCC 4.9, -Os optimize for size

Size of modules:
arm-none-eabi-size -B -t --common out/startup.o out/syscalls.o out/global.o out/init.o out/interrupt.o out/LEDClass.o out/main.o
text data bss dec hex filename
84 0 0 84 54 out/startup.o
10 0 0 10 a out/syscalls.o
260 8 5 273 111 out/global.o
120 0 0 120 78 out/init.o
20 0 0 20 14 out/interrupt.o
112 0 0 112 70 out/LEDClass.o
112 0 0 112 70 out/main.o
718 8 5 731 2db (TOTALS)
Size of target .elf file:
arm-none-eabi-size -B out/demo.elf
text data bss dec hex filename
548 8 1544 2100 834 out/demo.elf

The .bin is 828 bytes the .hex 1631
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 May 16, 2016 at 10:11

Hi to all,

I followed your suggestions, but I had no results, so I would change my question, that is:

Which compiler do you use?

How do you configure it?

Problem can be spit in three parts:

- compiler

- startup code

- program code

So I start thinking problem could be startup.s or flash.ld files.

I annex the ones I use.

Thank you

Freya

________________

Attachments :

Flash.ld : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hthf&d=%2Fa%2F0X0000000aVx%2F9Ct_oX_Wdtelk9BCfjEzJy5C5qqhhAOlkWlZFzylpAI&asPdf=false

startup.S : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hthp&d=%2Fa%2F0X0000000aVy%2FSmp1qC5cBnApRt9mBGVqDB2_eAhqNe4ZpjLPEH4jHKU&asPdf=false

syscalls.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hthu&d=%2Fa%2F0X0000000aW0%2FeDbtrIiYXFPiQoN477pEgrbLVHBjUyDzGwuJCMqu8c8&asPdf=false
Posted on May 16, 2016 at 11:39

Maybe we should stick with what's the problem with the output code generated and work back from there.

 

So using a debugger and stepping through the code from the start what can you tell me about the nature of the failure.

What versions of the compiler and linker are being used.

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 May 16, 2016 at 20:06

Hi,

here are information about  environment:

Ide: EmIDE, version 2.20, SDK 1.13.14

C++ Compiler: arm-none-eabi-gcc-4.7.4.exe

Linker for dymanic libs: arm-none-eabi-gcc-4.7.4.exe

Linker for static libs: arm-none-eabi-ar.exe

I do not use a debugger, usually I download the code and debug my program using

  a lot of print() through usart interface.

freya17365
Associate II
Posted on June 17, 2016 at 13:30

Hi to all,

I tried to compile my program directly from command line, but I continue to experience problems.

In file bat.txt you can find commands I use. The rseult is an executable file of 26KB and, every time I deploy it to mcu, transfer stops at 80% of download.

I tried also to use arm-none-eabi-ld, but it never finds libc.a library

I annex also the .map file generated by compiler.

I would ask if someone can help me to decode .map file, or where can I find documentation about it?

Thank you

Freya

________________

Attachments :

bat.txt : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htdt&d=%2Fa%2F0X0000000aSC%2FyAQ_ONo9qLC4dbk7H3PWkybJGUa3VuWY6d3pXKNaNKA&asPdf=false

Led.map : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htb0&d=%2Fa%2F0X0000000aS3%2F7NCffHPrcZE6Zty8mOIV0SuxFzzdVnI1SKFHp.7wC7k&asPdf=false