This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiling CC2540 code in SDCC

Other Parts Discussed in Thread: CC2540, CC2420



I am a student and a part of my graduation assignment involves programming the CC2540 chip. The problem is that I'm not able to use the IAR compiler since I don't have a license. That's why I'm trying to use SDCC for compiling the SimpleBLE peripheral and proceed from there. 

Now I have a few questions about this,

- Has anyone been able to port the code to SDCC?

also, I have been trying to port the code to SDCC myself for the last few days and I want to know before I proceed,

- Is it possible to port the code to SDCC? or are there some (protected) files which only IAR can use?


I hope you can answer my questions.

Thanks in advance,


Gijs de Graaf

  • As far as I know, this is not possible. The libraries are built for IAR, and I believe IAR and SDCC use different C runtime models.

    You can use a 30 day evaluation version of IAR. If 30 days is not enough, you should check if your university has any IAR licenses or could purchase some. You should check if IAR offer academic discounts as may software companies do.

  • Is it possible for me to build a library for SDCC or is the code closed source?

  • The code is closed source.

  • The code is closed-source, but that does preclude TI from providing pre-built libraries that are SDCC-compatible? It would be no different to the current situation w.r.t. the IAR compiler (where we are provided with object files), but allow students/hobbyists to join in the fun. :-) 

  • I would also really appreciate pre-built CC2540 libraries for SDCC. We're a small startup who want to do interesting things with BLE but can't afford the IAR compiler yet.

  • I agree.   While I'm sure the IAR tools are good, their hefty pricetag precludes hobbyists and students from creating something cool with the CC25xx series / BTE.   It shouldn't take 4 months for someone to compile the source so I am assuming TI has no intention of supporting the student and hobbyist community.   Someone in management should look at the success of Arduino and what it has done for Atmel, then look at how few embedded engineers you can find online evangelizing TI components.  Perhaps you should revisit who is important, old well-funded engineers, or every up and coming kid...  and as an old engineer, I'd like some SDCC compatible libraries too.  Do you guys own a piece of IAR or something?

  • Since some time has gone since initial question: Is there meanwhile a lib for CC2420 and SDCC?

    Or has someone successfully used the delivered IAR lib with SDCC?

  • I would like to show my support for this notion too.  I'm fortunate enough to be a student at a university with an IAR license, but it bothers me that I won't be able to play with this cool new stuff  when I graduate soon.  Especially for all the iOS developers, like me, who flocked to BLE as the first BT type supported by Apple for a general piconet communication without the need for joining MFI.  The barrier of entry now is certainly lower than the cost of that, but the IAR cost is still keeping out the ones who should be your prized customers - up and coming engineers and developers.  Could someone at TI please inform us of the reason for this?

  • TI-BLE 1.3 was released some days ago. Is there perhaps a change on this topic?

    Is IAR still the only compiler useable to build software for TI's BLE?

  • Yes, IAR is still the only compiler.

  • Why? Is there any technical reason? Compiling and generating a lib for a different compiler is perhaps not a big problem?

    Or is it just the double work / double testing? Perhaps even double certification / double cost?

    Could it be a solution to get a non-IAR lib, which can't be used in a real product, with no support from TI?

    General interest:

    Does IAR work under Linux? Can BLE software compiled with IAR under Linux?

    Suggestion for next TI-BLE deliveries:

    Would it be possible to add at least pre-compiled HEX files for each of the delivered examples?

  • Hi Martin,

    Martin Maurer52841 said:
    Would it be possible to add at least pre-compiled HEX files for each of the delivered examples?

    That's a very good idea. Maybe it makes sense to write a wiki page with all those published. I'll see what I can do.


  • Hi again,

    Hex files for almost all BLEv1.3 example projects are found here. I will compose a wiki page with there when I find some time for that. 


    Also available here:

    6332.BLE1v3 Hex.rar

  • Hi Nick,

    just want to say a BIG collective THANK YOU, for compiling all the examples and publishing them!

    This makes life much easier.

    Best regards,


  • Hey, it is really a great idea to provide procompiled binaries of the examples. Is there a Version for current BLE Stack 1.4?

    AS for me, I have a very simple Job for the 2540 to do: just broadcast some data. And I have an external MCU anyway. For such an application I would welcome the idea of AT commands, like Blueradios does:

    I guess there is no chance to see this in an example one day, is there? So I have to push my activity into the 30 days period.

  • Hello I'm entering TI + IAR world and always have used gcc compilers in a wide series of chipsets.... 

    I was looking if there were alternatives to program and develop for those CC2540 chips, it's a very simple app what I have to do and I don't have the budget to buy another WIN PC (im unix) and... well the history everyone tells.

    So, Can I link this binary hex file as static code someway to use say SDCC or xflavor-gcc?
    Best regards.



    Hex files for almost all BLEv1.3 example projects are found here. I will compose a wiki page with there when I find some time for that. 


  • This is pretty sad . I spent more than a week googling the net to find the best BT BLE chip for the project I am working on. Finally I came to the conclusion that TI CC2540 is a way to go. Than I stumbled upon IAR licensing obstacle. Right now it is very clearly for me why the CC2540 is not very popular among DIY crowd