EEVblog #1306 (4 of 5): 3 Cent Micro - SDCC C Compiler - Page 1
Forum section: electronics / general

author: EEVblog
author_rank: Unknown
timestamp: May 16, 2020, 11:04:59 pm
content: 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/

author: SilverSolder
author_rank: Super Contributor
timestamp: May 16, 2020, 11:54:05 pm
content: Heroic effort!

author: johnlsenchak
author_rank: Frequent Contributor
timestamp: May 16, 2020, 11:58:57 pm
content: All that work to blink a LED and write "hello world" Hugecomagotchain in my opinionWhat 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

author: wilfred
author_rank: Super Contributor
timestamp: May 17, 2020, 02:09:01 am
content: 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.

author: dreamcat4
author_rank: Frequent Contributor
timestamp: May 17, 2020, 11:18:32 am
content: 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/C51However 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/2499which perhaps might help too. For a better IDE support

author: username123
author_rank: Newbie
timestamp: May 17, 2020, 04:57:13 pm
content: 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?

author: spth
author_rank: Regular Contributor
timestamp: May 17, 2020, 08:37:14 pm
content: 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.

author: spth
author_rank: Regular Contributor
timestamp: May 17, 2020, 09:04:26 pm
content: 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.

author: EEVblog
author_rank: Unknown
timestamp: May 18, 2020, 07:05:57 am
content: Quote from: wilfred on May 17, 2020, 02:09:01 amIt 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.QuoteIt's not worth my time doing a 6th video trying to debug this IMO, I'm over it.QuoteI 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.

author: spth
author_rank: Regular Contributor
timestamp: May 18, 2020, 07:21:47 am
content: 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).

author: spth
author_rank: Regular Contributor
timestamp: May 18, 2020, 07:39:37 am
content: Quote from: EEVblog on May 18, 2020, 07:05:57 amI 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.

author: SilverSolder
author_rank: Super Contributor
timestamp: May 18, 2020, 11:10:52 am
content: The low cost of the Padauk silicon will make it worth it for people to persevere...