Author Topic: EEVblog #1306 (4 of 5): 3 Cent Micro - SDCC C Compiler  (Read 3953 times)

0 Members and 3 Guests are viewing this topic.

Online EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 38718
  • Country: au
    • EEVblog
EEVblog #1306 (4 of 5): 3 Cent Micro - SDCC C Compiler
« on: May 16, 2020, 11:04:59 pm »
Installing and using the Small Device C Compiler (SDCC) for the 3 cent Padauk microcontroller and programming a chip using the Free PDK open source programmer.
Part 4 of 5 in this video series.
https://github.com/free-pdk/

 
The following users thanked this post: takeda

Offline SilverSolder

  • Super Contributor
  • ***
  • Posts: 6126
  • Country: 00
Re: EEVblog #1306 (4 of 5): 3 Cent Micro - SDCC C Compiler
« Reply #1 on: May 16, 2020, 11:54:05 pm »

Heroic effort!  :D
 

Offline johnlsenchak

  • Frequent Contributor
  • **
  • !
  • Posts: 399
  • Country: us
  • js@antihotmail.com
    • paypal.me/johnsenchak
Re: EEVblog #1306 (4 of 5): 3 Cent Micro - SDCC C Compiler
« Reply #2 on: May 16, 2020, 11:58:57 pm »


All    that  work to blink  a  LED and   write  "hello world"    Huge  comagotcha in  in my  opinion


What  you are    doing reminds  me  of writing  java-script ( C++  based) code  files in the late  nineties  that ended  in .JS.  They  ran   during  the runtime  of a  website  for  special  functions  on a webpage ,   that the code was   downloaded  off a  server , instead of being  ran in the normal  HTML  code    The only  thing was  no compiling was needed
John Senchak "Daytona  Beach  Florida "
 jls (at)  antihotmail.com   http://www.antihotmail.com
https://www.facebook.com/john.senchak.1
 

Online wilfred

  • Super Contributor
  • ***
  • Posts: 1262
  • Country: au
Re: EEVblog #1306 (4 of 5): 3 Cent Micro - SDCC C Compiler
« Reply #3 on: May 17, 2020, 02:09:01 am »
These videos are entertaining watching you come-a-gutsa with unforseen problems.  Thanks for making them even if I will probably never program a PADAUK. The skills are transferable. It was a pity you didn't show the repair of the programmer especially since you commented you were hoping it didn't work first time. Unraveling the problems with the "Hello World" would also be interesting since in the world of microcontrollers it is exactly the sort of problems you have to deal with after hardware construction issues are sorted out.  So worth seeing for the very same reason. To learn from your mistakes. You wouldn't get all that from a 10 minute run through without issues. I'm sure people like me learned something.

A video on porting the code from a flash version to a OTP version would be useful even though the chips are cheap.

That said, a straight run through tutorial would still be worth putting together just because you have the footage allready. Good for when you come back in 6 months and need to refresh yourself.

 

Offline dreamcat4

  • Frequent Contributor
  • **
  • Posts: 495
  • Country: gb
Re: EEVblog #1306 (4 of 5): 3 Cent Micro - SDCC C Compiler
« Reply #4 on: May 17, 2020, 11:18:32 am »
This chinese developer has a github here. With instructions for how to use SDCC compiler in the v microsoft vs code IDE. For programming the 8051 in C... so maybe you can follow his suggestions here for configuring that IDE for these paduk micrros tooo.

https://github.com/haozewu/C51

However he also says a disadvantage of SDCC is 'no debugger' when compared to keil. Whatever that is.

Another thing is to google 'vscode sdcc' --> leads to this open issue here:

https://github.com/microsoft/vscode-cpptools/issues/2499

which perhaps might help too. For a better IDE support

 :-//
 

Offline username123

  • Newbie
  • Posts: 1
  • Country: 00
Re: EEVblog #1306 (4 of 5): 3 Cent Micro - SDCC C Compiler
« Reply #5 on: May 17, 2020, 04:57:13 pm »
Never had Padauk in hands and make just one brief look on Free PDK a few hours ago. May be I wrong, but... Dave, can you read?
 

Offline spth

  • Regular Contributor
  • *
  • Posts: 163
  • Country: de
Re: EEVblog #1306 (4 of 5): 3 Cent Micro - SDCC C Compiler
« Reply #6 on: May 17, 2020, 08:37:14 pm »
The use of multiple sdcc invokations to compile to .rel object files first, then linking is the normal workflow for projects with multiple source files (of course it also works for one file).

When you have only only one source file, a single invokation of sdcc -mpdk14 hello.c will directly give you a hello.ihx.
 
The following users thanked this post: EEVblog

Offline spth

  • Regular Contributor
  • *
  • Posts: 163
  • Country: de
Re: EEVblog #1306 (4 of 5): 3 Cent Micro - SDCC C Compiler
« Reply #7 on: May 17, 2020, 09:04:26 pm »
Two minor remarks regarding the size:

* printf() only works that well in the example due to SDCC being able to optimize it based on the argument being a simple string (no conversion specifiers) terminated by '\n'. More complex printf use will eat much more memory.

* At 34:45 Dave says "like half the memory" after writing a 904-Byte .ihx into a device with 2KW code memory, apparently equating .ihx file size in bytes with programmemory size in words. However, .ihx is not a very compact format (after all it is readable text), so that 904B .ihx will have much fewer bytes of actual data in it. And each word in the memory is 13 bits, substantially more than the 8 bits in a "standard" byte.
 

Online EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 38718
  • Country: au
    • EEVblog
Re: EEVblog #1306 (4 of 5): 3 Cent Micro - SDCC C Compiler
« Reply #8 on: May 18, 2020, 07:05:57 am »
These videos are entertaining watching you come-a-gutsa with unforseen problems.  Thanks for making them even if I will probably never program a PADAUK. The skills are transferable. It was a pity you didn't show the repair of the programmer especially since you commented you were hoping it didn't work first time.

It was an obvious joint missed and found on a 2nd visual inspection and that was it. No real value in showing that (and capture PC was off at the time, so couldn't bothered), so I just mentioned it was a missed joint.

Quote
Unraveling the problems with the "Hello World" would also be interesting since in the world of microcontrollers it is exactly the sort of problems you have to deal with after hardware construction issues are sorted out.  So worth seeing for the very same reason.

It's not worth my time doing a 6th video trying to debug this IMO, I'm over it.

Quote
That said, a straight run through tutorial would still be worth putting together just because you have the footage allready.

I suspect the footage would suck re-edited and it would probably be easier to just re-shoot it. Not going to happen, I've done enough on this, moving on to other things.
 

Offline spth

  • Regular Contributor
  • *
  • Posts: 163
  • Country: de
Re: EEVblog #1306 (4 of 5): 3 Cent Micro - SDCC C Compiler
« Reply #9 on: May 18, 2020, 07:21:47 am »
Thanks Dave, for doing this series.

It gave us some insight into rough edges (for beginners) of the current toolchain, and allows us to improve it (e.g. I fixed the link in the SDCC manual that was still pointing to the location of the previous wiki, and someone already submitted a patch that  makes SDCC give better error messages for file permissions problems, such as you running it in a directory where no file writes were possible).
 
The following users thanked this post: SilverSolder

Offline spth

  • Regular Contributor
  • *
  • Posts: 163
  • Country: de
Re: EEVblog #1306 (4 of 5): 3 Cent Micro - SDCC C Compiler
« Reply #10 on: May 18, 2020, 07:39:37 am »
I've done enough on this, moving on to other things.

I agree that there is probably not much point for that now. However, it might make sense to revisit in a year or two; I guess by then we'll have better integration with further tools (e.g. Code::Blocks might come with a wizard for Padauk projects). Code::Blocks already has okayish SDCC support, and AFAIK, someone is also looking into Padauk support for PlatformIO.

Also, SDCC versions with Padauk backends are now making their way into OS distributions (e.g. Debian updated their SDCC from 3.8.0 to 4.0.0 just a few days ago), also making the toolchain more accessible.
 

Offline SilverSolder

  • Super Contributor
  • ***
  • Posts: 6126
  • Country: 00
Re: EEVblog #1306 (4 of 5): 3 Cent Micro - SDCC C Compiler
« Reply #11 on: May 18, 2020, 11:10:52 am »

The low cost of the Padauk silicon will make it worth it for people to persevere...
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf