Reply
<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> jmg
Posts: 1,136
Registered: ‎04-27-2004

Re: Add the SDCC compiler to simplicity studio

[ Edited ]

erikm wrote:

Virtually all embedded solutions run under Linux,  Rather "all Eclipse/GCC based ..."


smike wrote: Linux is dominant on embedded consumer devices. I have no figure, but a guess would be over 75%. I think that would make a good case for Kiel, Silab and others that has gotten stuck on Windows to take the step over to Linux. I'm sure this will happen, just don't understand why they move so slow. Perhaps corporate culture. There are no technical reasons not to.


 That 'logic' makes no sense at all, just because my TV Skype Box, or router,  boots Linux, is no reason to host a development system on it.

 Support and testing may not be 'technical reasons'; but they are real costs.

 

Altera may claim 'Linux'; but the tales of woe I read about the myriad flavours of Linux not quite running everything in Quartus properly, underlines the user-cost that Linux brings to the table.

 Your case provides another example. - I just choose the OS that gives me the least-pain, and I prefer it stays out of my way, so I can get real work done.

 

 

 

<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> jmg
Posts: 1,136
Registered: ‎04-27-2004

Re: Add the SDCC compiler to simplicity studio



jmg wrote:

I've not tested that, but if you need to get stuff done, I'd suggest first running a windows install while you get the feel for how the tools work, then try port to other OS.



smike wrote: I did just that, but used the Linux version of Simplicity Studio which works fine when building from the gui. I run into trouble when trying to build on cli from the same install. I tried to use the make files the gui creates, but the licensing fails then.


Did you try command line under Windows ? I just checked a Batch I have for Keil build, and that seems to run fine ? - no license messages ?

 


smike wrote:

Yeah, sdcc developers follows the spec, no matter what the world is doing :-) I will probably make a patch for that, i think it's a no brainer. But perhaps you have already cracked this, so maybe i just follow your work above, thanks :-)   


 Do you mean patch the SDCC source ? That would be useful, and probably not complex as UPPERCASE is an added step, so a simple switch to skip that would be a start.

 

 As an interim workaround for CASE issue , I've suggested to SiLabs they make SS case-agnostic on the watch Names.

 That means you can type/paste what is in the source, for watch, and who cares if the OMF has UPPER only.

 

 Meanwhile, using the SDCC combination of OMF/HEX/RST/Source files  can 'work' in current SS enough to make progress.

Posts: 18
Registered: ‎08-08-2015

Re: Add the SDCC compiler to simplicity studio


jmg wrote:

Did you try command line under Windows ? I just checked a Batch I have for Keil build, and that seems to run fine ? - no license messages ?


Ah, no, i did not try it in windows. I will try. 

 


jmg wrote:

 Do you mean patch the SDCC source ? That would be useful, and probably not complex as UPPERCASE is an added step, so a simple switch to skip that would be a start.


Yes, I will make a patch and share it here. Still have no boards to test on, so that will take a few days.

 


jmg wrote:

 As an interim workaround for CASE issue , I've suggested to SiLabs they make SS case-agnostic on the watch Names.

 That means you can type/paste what is in the source, for watch, and who cares if the OMF has UPPER only.


In the long run that is probably the best solution. I doubt that sdcc devs will ever accept that patch into trunk.

Posts: 18
Registered: ‎08-08-2015

Re: Add the SDCC compiler to simplicity studio


jmg wrote:

 Do you mean patch the SDCC source ? That would be useful, and probably not complex as UPPERCASE is an added step, so a simple switch to skip that would be a start.


Here's a patch against sdcc 3.5.2 that preserves case for symbols in the omf51 records. It has no switches or the like, just removes the case translation.

 

I had no chance to test this, more than looking at the debug info after compile, but i think it should be ok.

 

Please let me know if it works.

Posts: 203
Registered: ‎02-04-2013

Re: Add the SDCC compiler to simplicity studio

All,

 

  Just a quick not on the 'supporting Linux' front. As far as I'm aware all tools inside of studio (including Keil) run under both Linux and MacOS. I'm pretty sure the Studio guys are running Keil under Wine to get full 8-bit development under those OS's. 

 

  This is another reason adding SDCC support is a little more complicated then you might expect. In addition to getting debugging support in place we need to get it running (robustly) under all 3 OS's.  

----------------------------
Josh Norem
Senior Applications Engineer
Silicon Labs
<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> jmg
Posts: 1,136
Registered: ‎04-27-2004

Re: Add the SDCC compiler to simplicity studio


smike wrote:

jmg wrote:

 Do you mean patch the SDCC source ? That would be useful, and probably not complex as UPPERCASE is an added step, so a simple switch to skip that would be a start.


Here's a patch against sdcc 3.5.2 that preserves case for symbols in the omf51 records. It has no switches or the like, just removes the case translation.

 

I had no chance to test this, more than looking at the debug info after compile, but i think it should be ok.

Please let me know if it works.


I can't test just a patch file, but  I do have numerous OMF readers, so an OMF/HEX/RST/Source  file set I could test.  (Ideally, with a smattering of all data types)

 


smike wrote:
I doubt that sdcc devs will ever accept that patch into trunk..

hehe you may be right, but to improve the chances of an accepted patch, I would suggest a switch with default off.

That means all existing SDCC builds have zero change in operation.

 

If you are on a roll there Robot wink -  under the same switch, you could add a FileName OMF record (24H), missing in SDCC - it goes right after each MODULE record (10H)  & includes source extension.

Adding the missing (24H) should sidestep the 'find source' issues in SS, and give working Source Code Step in SDCC Robot Happy

 

Keil OMF dump (BL51 Std OMF)  : This one works..

ADDRESS         TYPE            NAME                            OMF_Rec
=======         ====            ====                            =======

-------         MODULE        EFM8UB1_UART_INTERRUPT            OMF:10H,00H,16H,45H,46H,4DH
-------         FileName:     EFM8UB1_UART_INTERRUPT.C          OMF:24H,00H,00H,00H,18H,45H
C:0000H         SYMBOL (  5)  _ICE_DUMMY_                       OMF:22H,00H,00H,00H,00H,05H
B:00A0H         SYMBOL (  1)  P2_One_BCEN                       OMF:22H,01H,04H,A0H,00H,01H
D:00A0H         SYMBOL (  3)  P2                                OMF:22H,01H,02H,A0H,00H,03H
B:00A3H         SYMBOL (  1)  DISP_EN                           OMF:22H,01H,04H,A3H,00H,01H
C:011EH         SYMBOL ( 32)  main                              OMF:22H,01H,00H,1EH,01H,20H
D:00F0H         SYMBOL (  3)  B                                 OMF:22H,01H,02H,F0H,00H,03H

                              ^^^^^ Case preserved

            

SDCC OMF dump: missing 24H and UPPER'd

ADDRESS         TYPE            NAME                            OMF_Rec
=======         ====            ====                            =======

-------         MODULE        SIMPLELEDS                        OMF:10H,00H,0AH,53H,49H,4DH
<< FileName record goes here

C:007AH         SYMBOL (  0)  SCANKEYS                          OMF:12H,01H,00H,7AH,00H,00H
C:00B6H         SYMBOL (  0)  PUTCHAR                           OMF:12H,01H,00H,B6H,00H,00H
C:00BAH         SYMBOL (  0)  TG_LONGS                          OMF:12H,01H,00H,BAH,00H,00H
C:0184H         SYMBOL (  0)  DELAY_US                          OMF:12H,01H,00H,84H,01H,00H
C:01A3H         SYMBOL (  0)  TIMER1_ISR                        OMF:12H,01H,00H,A3H,01H,00H
C:01BCH         SYMBOL (  0)  INT0_ISR                          OMF:12H,01H,00H,BCH,01H,00H
C:01BFH         SYMBOL (  0)  TIMER0_ISR                        OMF:12H,01H,00H,BFH,01H,00H
C:01FCH         SYMBOL (  0)  MAIN                              OMF:12H,01H,00H,FCH,01H,00H
D:0020H         SYMBOL (  0)  BBA0                              OMF:12H,01H,42H,20H,00H,00H
D:0028H         SYMBOL (  0)  J_INT                             OMF:12H,01H,42H,28H,00H,00H
D:002AH         SYMBOL (  0)  LONGI                             OMF:12H,01H,42H,2AH,00H,00H
D:002EH         SYMBOL (  0)  LONGA                             OMF:12H,01H,42H,2EH,00H,00H

                              ^^^^^ Case UPPERED

Posts: 18
Registered: ‎08-08-2015

Re: Add the SDCC compiler to simplicity studio


jmg wrote:

I can't test just a patch file, but  I do have numerous OMF readers, so an OMF/HEX/RST/Source  file set I could test.  (Ideally, with a smattering of all data types)


I cross compiled to Win32 from Linux and built a patched version. It runs on Win7. I built static so you wont need additional dll's, so the executables are a bit big.

 

It's still only the case conversion patch, i will look into adding omf records later when i have time.

 

Let me know if it works.

Posts: 18
Registered: ‎08-08-2015

Re: Add the SDCC compiler to simplicity studio

Sorry about the double zip levels. This forum wont allow upload of bzip2 files:

Screen Shot 2015-08-13 at 6.48.02 PM.png

 

Perhaps admin could fix this?

 

Thanks.

Posts: 18
Registered: ‎08-08-2015

Re: Add the SDCC compiler to simplicity studio


jmg wrote:

I've not seen issues with Keil command line use re license, but I could believe wine and unix could add layers that make it less reliable.


I managed to get the Keil compiler to work under Linux cli. For others who are trying, here's one solution:

 

The problem is that Simplicity ships with a bundled copy of wine which have some registry values that is required by Keil licensing. To build via make under linux, do this in the Makefile:

 

export WINEPREFIX=$(HOME)/.config/SimplicityStudio/v3/studio-wine 

WINE = /opt/SimplicityStudio_v3/developer/utilities/third-party/wine/usr/bin/wine 

CC = $(WINE)/opt/SimplicityStudio_v3/developer/toolchains/keil_8051/9.53/BIN/C51

all: 
  $(CC) test.c
Posts: 8,068
Registered: ‎08-13-2003

Re: Add the SDCC compiler to simplicity studio

[ Edited ]

I do not know if this is relevant in this, but there is one issue with Keil that has existed for ages: Keil does not like file names with spaces

erik
<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> jmg
Posts: 1,136
Registered: ‎04-27-2004

Re: Add the SDCC compiler to simplicity studio



I managed to get the Keil compiler to work under Linux cli. For others who are trying, here's one solution:

 

The problem is that Simplicity ships with a bundled copy of wine which have some registry values that is required by Keil licensing. To build via make under linux, do this in the Makefile:

 


That's great, and should be something SiLabs add to the Knowledge Base .

 


smike wrote:

It's still only the case conversion patch, i will look into adding omf records later when i have time.

 

Let me know if it works.


Says not a win32 exectable when I try here, but it should be quick to test in SS.

First check a non-patched version, by giving SS OMF and HEX and check DisAsm step,labels, and under Watch enter a UPPER variable name. If it accepts the name, it means SS found that in the OMF.

(issues remain on the actual value, but that's not a OMF issue..)

 

Then, replace the OMF with a Case one, and retest, this time with correct case names

.

If you can add  Rec24H, then (hopefully) source step will not need manual interventions.

That also should be a relatively simple patch, as the MODULE record always comes right before FILENAME, and I think strips the filename for MODULE ?

 

Posts: 18
Registered: ‎08-08-2015

Re: Add the SDCC compiler to simplicity studio


jmg wrote:

That's great, and should be something SiLabs add to the Knowledge Base .

 


Who does that? me?

 


jmg wrote:

Says not a win32 exectable when I try here, but it should be quick to test in SS.

 


Ah, it was a 64 bit build. Attached a 32bit build that will work. I accidentally included debug info in the last build - things are smaller now :-)

 

I have other things i need to do, will get back with an update for omf as soon as i have time.

Posts: 2,968
Registered: ‎02-07-2002

Re: Add the SDCC compiler to simplicity studio


jonorem wrote:

This is another reason adding SDCC support is a little more complicated then you might expect. In addition to getting debugging support in place we need to get it running (robustly) under all 3 OS's.  


SDCC is distributed for all these three OS's. This is really no excuse.

Posts: 2,968
Registered: ‎02-07-2002

Re: Add the SDCC compiler to simplicity studio


jmg wrote:

If you are on a roll there Robot wink -  under the same switch, you could add a FileName OMF record (24H), missing in SDCC - it goes right after each MODULE record (10H)  & includes source extension.


That's funny. I asked you in a personal email if you could point me to a definition of this FileName record and got no reply and now you present it here in the SiLabs forum.

 

And it's true that SDCC is generally created against specifications and not from reverse engineering possibly copyrighted file formats. Implementing a specification is hard enough in itself, we don't need extra work in the form of reverse engineering. And we also do not want to run the risk of being sued by a company as big as ARM (Keil).

 

Maarten Brock

SDCC Developer

Posts: 2,968
Registered: ‎02-07-2002

Re: Add the SDCC compiler to simplicity studio


jmg wrote:

smike wrote:
I doubt that sdcc devs will ever accept that patch into trunk..

hehe you may be right, but to improve the chances of an accepted patch, I would suggest a switch with default off.

That means all existing SDCC builds have zero change in operation.


With a switch to use this extension or not it could very well be accepted in SDCC's trunk. We welcome you to post it in our patch tracker.

Posts: 18
Registered: ‎08-08-2015

Re: Add the SDCC compiler to simplicity studio


vanmierlo wrote:

With a switch to use this extension or not it could very well be accepted in SDCC's trunk. We welcome you to post it in our patch tracker.


That's good news. Reason for my conclusion was this post on your bug tracker. It should be trivial to add. I will when we get our prototype boards so i can test it.

<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> jmg
Posts: 1,136
Registered: ‎04-27-2004

Re: Add the SDCC compiler to simplicity studio


vanmierlo wrote:

jmg wrote:

If you are on a roll there Robot wink -  under the same switch, you could add a FileName OMF record (24H), missing in SDCC - it goes right after each MODULE record (10H)  & includes source extension.


That's funny. I asked you in a personal email if you could point me to a definition of this FileName record and got no reply and now you present it here in the SiLabs forum.

 ..

 

Maarten Brock

SDCC Developer


Nope, not according to my message logs Robot Happy - No OMF questions, just a suggestion I use the SDCC mailing list & the usual line of OMF Uppercase is Specified.

 

Not to worry, I figured out ways SiLabs could work-around the missing SDCC info, and sent that to Silabs, and since then I also extended our OMF handlers, to export a piece of the records, & posted here, as I saw someone motivated to improve SDCC to work with SiLabs.

 

The good news for SDCC users, is it sounds like this might finally make it into SDCC 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> jmg
Posts: 1,136
Registered: ‎04-27-2004

Re: Add the SDCC compiler to simplicity studio


smike wrote:

vanmierlo wrote:

With a switch to use this extension or not it could very well be accepted in SDCC's trunk. We welcome you to post it in our patch tracker.


That's good news. Reason for my conclusion was this post on your bug tracker. It should be trivial to add. I will when we get our prototype boards so i can test it.


Good news. Even if you post .OMF/.HEX/.Source set here, it will be able to be tested.

( I have 4 tool-flows here that can swallow OMF files.)

Posts: 2,968
Registered: ‎02-07-2002

Re: Add the SDCC compiler to simplicity studio


jmg wrote:

vanmierlo wrote:

That's funny. I asked you in a personal email if you could point me to a definition of this FileName record and got no reply and now you present it here in the SiLabs forum.


Nope, not according to my message logs Robot Happy - No OMF questions, just a suggestion I use the SDCC mailing list & the usual line of OMF Uppercase is Specified.


I'm sorry, I looked it up again and I replied to your question on the sdcc developer mailing list which was only sent to this mailing list without a copy to you personally. See here.

 

But it seems like your example OMF dump is wrong. The last column with the bytes is missing the record length after the record type.

<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> jmg
Posts: 1,136
Registered: ‎04-27-2004

Re: Add the SDCC compiler to simplicity studio



But it seems like your example OMF dump is wrong. The last column with the bytes is missing the record length after the record type.


Well, yes - Length is a structural value, always handled the same by OMF parser, the bytes dumped are the ones that change in contents - ie the Variables.

 

Does this mean FileName is being added to SDCC ?  Robot Happy

Posts: 2,968
Registered: ‎02-07-2002

Re: Add the SDCC compiler to simplicity studio

Does this mean FileName is being added to SDCC ?  Robot Happy

 

Well, I was looking into it at least.

 

Length is a structural value, always handled the same by OMF parser, the bytes dumped are the ones that change in contents - ie the Variables.

 

Then what do all those zeroes mean in the FileName record?

<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> jmg
Posts: 1,136
Registered: ‎04-27-2004

Re: Add the SDCC compiler to simplicity studio

[ Edited ]

Then what do all those zeroes mean in the FileName record?

No idea, in all the OMF files I've checked, those VAR fields are always 00 00 00

I assumed they 'borrowed' another record format to use for the FileName.

 

Some systems export FileName.ext,  and some include C:\Full\Path\FileName.ext

The ones with just FileName.ext usually have the same dir as OMF is found in.

Posts: 18
Registered: ‎08-08-2015

Re: Add the SDCC compiler to simplicity studio

Short update. 

 

I have made some work on sdcc for SS's debugger together with jmg, and it does start to look better.

Things fixed so far is:

 

- sdcc omf recognized by SS

- Variable types decoded correctly by SS (char, int, signed/unsigned etc) 

- Multiple C source files properly tracked by SS

- Variables pop up automatically in "Variables" pane in SS

- A file name bug in sdcc trunk has been resolved (Windows)

 

There are some issues that need to be mangled out, but it looks like we can have a working sdcc compiler in the future.

 

@vanmierlo Would the sdcc dev team be interested in this? I sent a mail to the dev mailing list, but heard nothing more.

Posts: 2,968
Registered: ‎02-07-2002

Re: Add the SDCC compiler to simplicity studio

Hello @smike

 

I saw the email on the mailing list but did not have the time yet to reply. My apologies.

 

I think we would be interested. Could you post it (as a patch) in our patch tracker at sourceforge? If you need help generating the patch, just ask.

 

Maarten

Posts: 18
Registered: ‎08-08-2015

Re: Add the SDCC compiler to simplicity studio


vanmierlo wrote:

Hello @smike

 

I saw the email on the mailing list but did not have the time yet to reply. My apologies.

 

I think we would be interested. Could you post it (as a patch) in our patch tracker at sourceforge? If you need help generating the patch, just ask.

 

Maarten


There's actually not that many changes, but they might break current functionality to other tools, so i need to explore the best way to add these changes. In short, this is what have been done so far:

 

- Symbol names preserve case in omf files.

- Source filenames have extensions in cdb and omf files. 

- Filename records added to omf (record type 0x24).

- Debug records have type (char, int, unsigned etc) information (record type 0x12).

- Omf generation patched to support multiple source files (i think that was a bug in trunk).

- Source file names converted to upper case in sdcc for any system that defines HAVE_DOS_BASED_FILE_SYSTEM. There's a bug in trunk that silently fail in omf/hex generation if different cases are used for filenames (i.e. "a.c" in compile and then "A.rel" in link - this works fine in case sensitive system as the OS fail to open one of the files, but pass on Windows. The internal module names are derived from the file name, so the linker fails to match the module names and then fails silently).

- I have started to  add support for bit variables. The omf generation is done, but it turned out to be a bit more work as map does not generate relevant debug info yet (map calls cdb generation in turn).

- struct/union types might be supported in 0x12 records, but i have not yet started with that. 

 

So, if you were me, what path would you choose to integrate this changes into trunk? One switch for all changes? Or might some of this functionality be useful in other tools so they should be separated?

 

Cheers,

Mike

Posts: 2,968
Registered: ‎02-07-2002

Re: Add the SDCC compiler to simplicity studio

@smike

 

Anything you deem stable can be applied. It doesn't have to be one big update, but it can also grow.

 

Are you developing on Windows, linux or OS X? The latter two can easily run regression tests which it must pass to be accepted.

 

Are you using subversion or did you just download the source tar? Subversion can generate a patch for you.

 

The command line switch I used in my own preliminary hack at this was -yy. A single -y enables debug output, with -yy it would enable the OMF extensions.

Posts: 18
Registered: ‎08-08-2015

Re: Add the SDCC compiler to simplicity studio


vanmierlo wrote:

@smike

 

Anything you deem stable can be applied. It doesn't have to be one big update, but it can also grow.

 

Are you developing on Windows, linux or OS X? The latter two can easily run regression tests which it must pass to be accepted.

 

Are you using subversion or did you just download the source tar? Subversion can generate a patch for you.

 

The command line switch I used in my own preliminary hack at this was -yy. A single -y enables debug output, with -yy it would enable the OMF extensions.


Ok, that sounds good. I'll group related changes in a few patches. -yy is a good idea. 

 

I'm developing on Linux and testing win32 builds via wine. 

 

It pass "test-mcs51" regression test. I will check the other ports as well.

 

I took the source tar-ball (2015-09-16) and use git for my own code management. I haven't used subversion in eons. Are you by any chance moving to git?

 

 

Highlighted
Posts: 2,968
Registered: ‎02-07-2002

Re: Add the SDCC compiler to simplicity studio


smike wrote:

I'm developing on Linux and testing win32 builds via wine. 

 

It pass "test-mcs51" regression test. I will check the other ports as well.

 

I took the source tar-ball (2015-09-16) and use git for my own code management. I haven't used subversion in eons. Are you by any chance moving to git? 


That you checked and that it passes regression tests is good. Well done.

 

But we have no plans to change to git. Personally it doesn't jive with me. I don't understand it.