Reply
Posts: 435
Registered: ‎07-13-2015

Why does the EFR32 require IAR?

[ Edited ]

Hi,

 

Why does every EFR32 document start with asking me to install IAR? Could the default, gcc-based toolchain not produce code that is suitable for the EFR32? If possible, I'd very much prefer to use gcc.

<a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Hero</font></font> </a> rev
Posts: 313
Registered: ‎07-04-2014

Re: Why does the EFR32 require IAR?

Hi Timur, it appears that IAR is the only compiler that can be used for C programming.

Now if thats the case that is not good news.

Maybe someone from silabs can clarify ?

 

Paul

Posts: 435
Registered: ‎07-13-2015

Re: Why does the EFR32 require IAR?

@rev Hey Paul, let's just hope that whoever wrote those docs is just an IAR fan and the code works with gcc as well. Robot Happy

<a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Hero</font></font> </a> rev
Posts: 313
Registered: ‎07-04-2014

Re: Why does the EFR32 require IAR?

My thoughts are that it is only available for IAR at the moment but will be available for gcc.

Unless silabs is going to give us free unlimited licences for IAR.....dont think so Cat Wink

Lets see what happens

 

Paul 

Posts: 153
Registered: ‎01-06-2015

Re: Why does the EFR32 require IAR?

Hi,

 

IAR is only needed for the BLE stack we have on the EFR32.

The GCC support is on the roadmap.

 

If you need BLE support on EFR one free option is the BGScript.

 

 

Cheers,

Balázs

 

Posts: 435
Registered: ‎07-13-2015

Re: Why does the EFR32 require IAR?

Balázs,

When can we expect GCC support for the BLE stack? Isn't this just a matter of recompiling your code with GCC and releasing the .a file?
Posts: 2
Registered: ‎08-18-2015

Re: Why does the EFR32 require IAR?

I find this to be a particularly good question.

 

We were evaluating the 8051-based BLE113 module just last year and I understood why I had to buy an IAR compiler license for that ancient processor...nobody else supported it.  So we bit the bullet, bought that (IMO, horrible) IAR workbench software from the 90s and moved on.  

 

But when I saw that the BGM111 module was ARM-based, I got all excited.  Finally!  We can use gcc under Eclipse and life will be great again.

 

Sadly, that's not the case.  As the OP stated, every document I open starts with "Install IAR EWARM 7.30".  Why!?  The gcc compiler has perfectly good ARM support.  So I don't understand the reasoning yet.

 

Also, it's great that gcc support is on the roadmap, but where?  Are we talking a short drive around the corner or are we talking a trek across the US?  What kind roadmap are we looking at here?

 

Posts: 435
Registered: ‎07-13-2015

Re: Why does the EFR32 require IAR?

Okay, so I've experimented a little bit. I don't have my WSTK with me now, so I'm not actually sure if this method could produce code that actually runs on the EFR32 or not, but here it goes:

 

The BLE stack has 6 closed binaries: ble_stack.a, emdrv.a, emlib.a, linklayer.a, radio.a, wstk.a and accompanying header files. What each blob does exactly is documented in an accompanying pdf file. Examining these .a files with readelf tells me that they use the ARM EABI, so there is a chance that GCC might understand them as well.

 

Trying to use this .a files with GCC produces some cool error messages, but the only real issue here is that ble_stack.a contains symbols that collide with those of the startup files (startup_efr32devicename.S and system_efr32devicename.c). Let's examine ble_stack.a with our trusty friend ar:

 

ar t ble_stack.a

Which gives us the shocking result that somebody mistakenly complied the startup files of the EFR32MG1P device into ble_stack.a, because it contains a system_efr32mg1p.o and a startup_efr32mg1p.o file. At this point I'm not sure how this could work with any compiler, since it surely contains symbols that collide with the startup file of the device.

 

Let's get rid of the offending files, note that this will modify the ble_stack.a file, fixing the mistake of bundling the startup files in it!

 

ar d ble_stack.a system_efr32mg1p.o
ar d ble_stack.a startup_efr32mg1p.o

After doing this, GCC doesn't have any complaints linking all six static libraries of the BLE stack to a simple "hello world" style application.

 

Unfortunately I can't test right now whether or not the code that I can produce this way actually runs on the device, because I'll only get my WSTK back next week. Until then, hope this helps! Robot Happy

Posts: 2
Registered: ‎08-18-2015

Re: Why does the EFR32 require IAR?

Very interesting.  I have only just opened my first project in simplicity, so I haven't had time to dig all that deeply yet.  I do recall one of the main hurdles in linking the BLE libraries for the BLE113 module with anything other than IAR had to do with some proprietary formatting that only IAR supported.  If that's not the case here, then that's intriguing to say the least.  Like you, I'm not sure what that means just yet, though.  Could it be that those startup routines included in the BLE library do something "special" with the SoC to enable some stuff that the standard routines do not (I'm thinking license checks here to enable functionality in the rest of the library, for example)?  No way to know without testing.

 

Regardless, given the project I'm working on, we will likely hold out for official gcc support which, according to the response I got from support, is slated sometime this summer-ish.  Until then...do we buy an IAR license or do we stick with BLE113 for now...that's the big question for us.  Robot Happy

Posts: 435
Registered: ‎07-13-2015

Re: Why does the EFR32 require IAR?

I believe IAR also has a 30-day free license. So that may be an option. (Or take a look at the CC2640 which documentedly supports GCC, I'm not sure if I'm allowed to say that on this forum.)

Posts: 7
Registered: ‎03-01-2016

Re: Why does the EFR32 require IAR?

Hi,

I'm starting from scratch with Blue Gecko Dev-Kit WSTK and I also want to use *only* GCC for compile applications for the SoC (using the BLE_stack). I do not install or buy the IAR workbench. I figured out the I can you the AppBuilder in Simplicity Studio to generate project file based on example (i tried smartPhone-example). My toolchain is set "unspecified" at first, but when the project is generated, I can change the Toolchain in "Project" --> "Build Configurations" --> "Manage" and choose "New" to configure the GNU ARM toolchain and set to "active". So good until this point, now the problem:

The project starts to compile and misses all the "gattdb_*" - Symbols. The "gatt_db.c" and ".h" are empty. May suppose is that the toolchain doesn't generate the "gattdb_*"- symbols from the XML-Gatt-profile-file (i.e. "ble_soc_cattdb.bgproj") as it should maybe there is a special pre-processing command to do that which is set normally when you use IAR Workbench. Anyway the description in "UG126.pdf" says it will "gererated". But anyway it should be possible in GNU ARM makefile, too. Probably it's not a big deal...

Does anyone has experiances how to generate "gatt_cb.c" and ".h" from ".bgproj"-File?

<a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Hero</font></font> </a> rev
Posts: 313
Registered: ‎07-04-2014

Re: Why does the EFR32 require IAR?

Hi Mario, as stated at the moment you cannot use GCC.

Maybe download the IAR eval version if you want to try it.

Other option is to wait for silabs to add the gcc support.

 

Paul

Posts: 435
Registered: ‎07-13-2015

Re: Why does the EFR32 require IAR?

Read AN975. It talks about IAR but has some useful information. It talks about the "bgbuild" tool which can generate those files for you. It's located at:

BluetoothSmartSDK/1.0.0.0-GA/sdk/iar-ew/bgbuild/bgbuild.exe

 

It can turn a .bgproj file into those .c and .h files.

Posts: 7
Registered: ‎03-01-2016

Re: Why does the EFR32 require IAR?

Hi Timur,

thanks for the advice with AN975. I figured out to generate the gattdb_*.*-Files. But anyway the project is not really "generated" and there are several further still missing dependencies (i.e. " ubt/bg_gattdb_def.h") which are not really generated from the AppBuilder in the Project tree if I don't have IAR....

 

Hopefully GCC-Support will come soon...

 

Posts: 7
Registered: ‎03-01-2016

Re: Why does the EFR32 require IAR?

Update,

 

I figured out the problem with missing "ubt/bg_gattdb_def.h.". The problem was a different location of the file in the SDK so I changed to "bg_gattdb_def.h" and it compiles without a problem...

 

Now I hang on the linker:

...

c:/siliconlabs/simplicitystudio/v3/developer/toolchains/gnu_arm/4.8_2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld.exe: cannot find -lemdrv
c:/siliconlabs/simplicitystudio/v3/developer/toolchains/gnu_arm/4.8_2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld.exe: cannot find -lemlib
c:/siliconlabs/simplicitystudio/v3/developer/toolchains/gnu_arm/4.8_2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld.exe: cannot find -lwstk
c:/siliconlabs/simplicitystudio/v3/developer/toolchains/gnu_arm/4.8_2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld.exe: cannot find -lble_stack
c:/siliconlabs/simplicitystudio/v3/developer/toolchains/gnu_arm/4.8_2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld.exe: cannot find -llinklayer
c:/siliconlabs/simplicitystudio/v3/developer/toolchains/gnu_arm/4.8_2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld.exe: cannot find -lradio

...

 

Anyway the path is configured ("-L"C:/SiliconLabs/BluetoothSmartSDK/1.0.0.0-GA//modules/lib/"), but I didn't find the libs...

 

Posts: 7
Registered: ‎03-01-2016

Re: Why does the EFR32 require IAR?

Last Post was not right:

I find the libs in the folder but the links doesn't find it...

Posts: 435
Registered: ‎07-13-2015

Re: Why does the EFR32 require IAR?

The solution for the linker problem is easy:

 

Go to your linker settings:

  1. Right-click the project
  2. Properties
  3. C/C++ Build
  4. Settings
  5. GNU ARM C Linker
  6. Libraries

Add the location of the .a files to Library search path (-L)

Then, add the libraries (-l), prefixed with a colon (Robot Happy

 

Screenshot from 2016-03-01 16-08-43.png

 

 

Posts: 7
Registered: ‎03-01-2016

Re: Why does the EFR32 require IAR?

Hi Timur,

I followed your instruction and now the linker recognizes the libs, great!!

But now it also generates new error messages... (see image)

My suppose is the the libs are compiled with IAR compiler, right? so maybe I have to first figure out how to compile the libs with GNU Toolchain probably...

Posts: 435
Registered: ‎07-13-2015

Re: Why does the EFR32 require IAR?

Mario, can you clean the whole project, rebuild and copy the entire build log into a pastebin, like pastebin.com (and then give us the link to it)?
Posts: 7
Registered: ‎03-01-2016

Re: Why does the EFR32 require IAR?

Posts: 435
Registered: ‎07-13-2015

Re: Why does the EFR32 require IAR?

Mario,

 

At this point I'm not entirely sure what the problem is, but I suggest that you try the thing I suggested in a previous post of mine (removing the startup and system object files from ble_stack.a using ar, but also make sure you keep a backup of the original ble_stack.a), and then include the startup and system files in the project that are meant for GCC.

Posts: 435
Registered: ‎07-13-2015

Re: Why does the EFR32 require IAR?

At the end of the day there are still two functions that ble_stack calls which are called __iar_vla_alloc2 and __iar_vla_dealloc2. These have to do with IAR's VLA (variable-length array) implementation and are not documented (at least google doesn't find anything useful).

 

So it seems that we are stuck, unless someone can dig up some information about how these functions should be implemented.

Posts: 7
Registered: ‎03-01-2016

Re: Why does the EFR32 require IAR?

Anyway it's a good exercise to figure out a workaround for IAR, but in time is running so finally I got a license for IAR. Now everything compiles...

Thanks Timur for help! Anyway hopefully GNU GCC support will come soon...

 

Next part is to understand the ble_stack-API.

Posts: 60
Registered: ‎03-13-2013

Re: Why does the EFR32 require IAR?

Hi, it's been a while now since this thread started and summer should just about be over for the US now, so how is the progress on GCC going? Do we have a date yet?

We're using Nordic chips until Silabs decide to give gcc support.

There are tools for that and we don't want to change until they make it easy for us.

We've done quite a number of BLE projects on Nordic since the blue gecko came out.

We do a lot of other stuff with EFM's and EZR's but can't convince them to change until the tools are ready to go in SStudio with GCC.

Silabs is missing opportunities here, tick-tock.

 

Thanks.

Posts: 1
Registered: ‎09-19-2016

Re: Why does the EFR32 require IAR?

The same for my company. We're evaluating both tghe Nordic and the Blue Gecko device family to become our next low-end platform for various projects we intend do be doing in the next couple of years, but using IAR is probably a no-go.

Posts: 22
Registered: ‎09-14-2016

Re: Why does the EFR32 require IAR?

I'm currently evaluating BGM111, IAR requirement is a huge turn off for me as I need more functionality than BGScript provides. Any news on GCC support, Silabs?

Posts: 2,602
Registered: ‎09-01-2015

Re: Why does the EFR32 require IAR?

Posts: 10
Registered: ‎08-22-2016

Re: Why does the EFR32 require IAR?

Hey, that's great.  Have the instructions for command-line building been posted yet?  I haven't seen them on the forum.  I'm currently trying to get at least SOMETHING to build because our IAR trial license just expired.  I have significant experience both building with the GNU toolchain by hand and manipulating Eclipse environments, but the generation process from the .isc file is a bit of a mystery to me.

Posts: 22
Registered: ‎09-14-2016

Re: Why does the EFR32 require IAR?

Hey, this looks good, I'm ordering test samples and a devboard tomorrow!

Posts: 2,602
Registered: ‎09-01-2015

Re: Why does the EFR32 require IAR?

GCC example for our BLE stack was just released as knowledgebase article, see following link:

http://community.silabs.com/t5/Bluetooth-Wi-Fi-Knowledge-Base/GCC-example-BLE-SDK-2-0-test-only/ta-p...

 

Posts: 22
Registered: ‎09-14-2016

Re: Why does the EFR32 require IAR?

I have tested this on Linux Mint 17.3 and it works fine!

Then I have tried configuring the empty_ble example to compile from Simplicity IDE.

I had to add include directories containing missing .h files (C/C++ General > Paths and Symbols > Includes > GNU C):

stacks/ble/v2.0.0.0/platform/emlib/inc
stacks/ble/v2.0.0.0/platform/Devices/SiliconLabs/EFR32BG1B/Include
stacks/ble/v2.0.0.0/platform/CMSIS/Include

I had to add Symbols (C/C++ General > Paths and Symbols > Symbols > GNU C):

_NO_SYSTEM_INIT
ERF32BG1B232F256GM48

I had to add Other objects to Linker (C/C++ Build > Settings > GNU ARM C Linker > Miscelaneous)

/home/miceuz/Downloads/SimplicityStudio_v4/developer/stacks/ble/v2.0.0.0/protocol/bluetooth_2.0/lib/binbootloader.o
/home/miceuz/Downloads/SimplicityStudio_v4/developer/stacks/ble/v2.0.0.0/protocol/bluetooth_2.0/lib/binstack.o
/home/miceuz/Downloads/SimplicityStudio_v4/developer/stacks/ble/v2.0.0.0/protocol/bluetooth_2.0/lib/stack.a
/home/miceuz/Downloads/SimplicityStudio_v4/developer/stacks/ble/v2.0.0.0/platform/Device/SiliconLabs/EFR32BG1B/Source/GCC/startup_efr32bg1b.S

I had to deselect No startup or default libs (-nostdlib) checkbox in C/C++ Build > Settings > GNU ARM C Linker > General so that linker stopped complaining about missing _start symbol.

Then I just had to provide an empty main() function and the build was successful. I'm still not sure if this produces a  runnable code, some compiler and linker settings might be suboptimal. Will try to build a more real example tomorrow.

Posts: 3
Registered: ‎11-17-2016

Re: Why does the EFR32 require IAR?

I also had some luck with getting the same project to work (Win7) , but when it tries to assemble, I get this

 

 Problem Event Name: APPCRASH
Application Name: as.exe
Application Version: 0.0.0.0
Application Timestamp: 57e95fd0
Fault Module Name: as.exe
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 57e95fd0
Exception Code: c00000fd
Exception Offset: 0002f049
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Additional Information 1: 0c9b
Additional Information 2: 0c9b4cfad3e83f2687d35bcb9ca3c38b
Additional Information 3: 34b6
Additional Information 4: 34b6eed33f0d3ff727324b9da6887c36

 

Happens when the startup file "startup_efr32bg1b.S" is included in the project 

 

Highlighted
Posts: 18
Registered: ‎07-13-2015

Re: Why does the EFR32 require IAR?

Hi, I tried your suggestions, and added some missing files from "emlib", but I still get these errors from the linker:

Description Resource Path Location Type
make: *** [soc-ibeacon_2.axf] Error 1 soc-ibeacon_2

C/C++ Problem

undefined reference to `gecko_cmd_msg' soc-ibeacon_2 line 2687, external location: /Applications/SimplicityStudio.app/Contents/Eclipse/developer/stacks/ble/v2.0.1.0/protocol/bluetooth_2.0/ble_stack/inc/soc/native_gecko.h

C/C++ Problem
undefined reference to `gecko_handle_command' soc-ibeacon_2 line 2631, external location: /Applications/SimplicityStudio.app/Contents/Eclipse/developer/stacks/ble/v2.0.1.0/protocol/bluetooth_2.0/ble_stack/inc/soc/native_gecko.h

C/C++ Problem
undefined reference to `gecko_handle_command' soc-ibeacon_2 line 2687, external location: /Applications/SimplicityStudio.app/Contents/Eclipse/developer/stacks/ble/v2.0.1.0/protocol/bluetooth_2.0/ble_stack/inc/soc/native_gecko.h

C/C++ Problem
undefined reference to `gecko_handle_command' soc-ibeacon_2 line 2718, external location: /Applications/SimplicityStudio.app/Contents/Eclipse/developer/stacks/ble/v2.0.1.0/protocol/bluetooth_2.0/ble_stack/inc/soc/native_gecko.h

C/C++ Problem
undefined reference to `gecko_handle_command' soc-ibeacon_2 line 2755, external location: /Applications/Simplicity Studio.app/Contents/Eclipse/developer/stacks/ble/v2.0.1.0/protocol/bluetooth_2.0/ble_stack/inc/soc/native_gecko.h C/C++ Problem
undefined reference to `gecko_init' main.c /soc-ibeacon_2 line 180

C/C++ Problem
undefined reference to `gecko_wait_event' main.c /soc-ibeacon_2 line 186

C/C++ Problem

 

any suggestion?

thank you!!!