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/
Forum: https://www.eevblog.com/forum/blog/eevblog-1306-(4-of-5)-3-cent-micro-sdcc-c-compiler/
#SDCC #C # Compiler
EEVblog Main Web Site: http://www.eevblog.com
The 2nd EEVblog Channel: http://www.youtube.com/EEVblog2
Support the EEVblog through Patreon!
http://www.patreon.com/eevblog
AliExpress Affiliate: http://s.click.aliexpress.com/e/c2LRpe8g
Buy anything through that link and Dave gets a commission at no cost to you.
Donate With Bitcoin & Other Crypto Currencies!
https://www.eevblog.com/crypto-currency/
T-Shirts: http://teespring.com/stores/eevblog

Hi Welcome to part four of the Paducah, A Three Cent Micro Controller programming series where we build up open source hardware and software to program these Three Cent Micro Controllers. Now in Part Three, we looked at. Uh, in. we got our programmer up and running.

We installed the firmware on there using Dfu mode. so in theory the programmer is ready to go, but we haven't tested it yet. So this video is actually going to be about using the Sdcc or the Small Device C Compiler and this is a compiler that supports the Paduc Micro Controllers. A lot of people on the Eevblog forum actually worked very hard to get all this stuff working.

so we now have a proper Nzc compiler that supports the Paduk. So yeah, can we actually use this Sdcc to actually compile a program for one of these product microcontrollers so that then we can generate an Intel Hex file to then use in the next part to actually use the programmer hardware to program? It sounds easy, but as usual, you know there's lots of hoops to jump through, right? So how do we program these product micro controllers? Well, of course you've seen in my previous video on this. We can use Products Software which is C like, kind of. It's not really C, it's Products C.

And the whole point of this is now that you can use an Open source, uh, like proper Nz C compiler to do this. and uh, to do this. Um, someone I don't know who. Um, sorry.

if I can find the name, I'll put it up. Uh, Cdc Small Device C compiler and this is an open source uh C compiler and it's regularly updated. As you can see, it's you know, just updated in January, Uh. 2020 4.0 release and it supports all these architectures 805.1 which is now used in, you know, a ton of generic uh micro controllers uh from Asia because they're using little farting novelty gadgets and greeting cards and things like that because you don't play any royalties on the 8051 architecture anymore.

Um, so yeah, that's got Rabbit2000. I used to do Rabbit2000 back in the day, used to love the Rabbit 2000, had like four serial ports on it. that was Whoa. Fantastic back in the day and also had a great deterministic a real-time operating system as well that was like really easy to use, Easy easy.

Anyone use the old? Anyone? use the Xolog Z80 micros anymore? um, Stm8 and Paduk and Pick Micros available as well. And uh, yeah, so it supports. I'm not sure if it supports all of the Uh Paduk microcontrollers, but you know it's going to support a good number of them so in different various packages. Now this is a command line compile.

As far as I'm aware, there's no Ide or integrated uh development environment for it. Um, so yeah. use your favorite, uh no Notepad Plus Plus or whatever it is. Uh, you want to use to write your actual Uh programs in and then you can, just, um, call the compiler.

And there's probably like you know various scripts and things you can do to automate all sorts of processes. But the general thing is, you write your text file containing your C program, you run it through the Sdcc uh compiler, you type, you know with a specific target to whatever product microcontroller you're using, what part number you're actually using, and then it will generate a binary file, which then we can use our newfangled programmer to program into it. So unfortunately, it's not like a seamless automated system like you'd get with your pick or your Avr's and it's all under one environment and all just seamlessly works. And like you know, you push a few menu buttons at the top and it compiles and downloads and does everything for you.
This is a bit, yeah it's it's a bit more tedious and but these could get better Um, over time in terms of like integration, support, script and support and things like that. But in this video series, the aim is just to write a standard Ansi C program, compile it using an Open Source compiler, and then program it using our open Source hardware so you don't have to. All you have to do is buy the microcontrollers from Padauk. You don't have to buy their Secret Screw or hardware.

You don't have to use their Secret Squirrel C compiler, Integrated environment, and things like that can all be done using Open Source tools. Cool Now which product Micro Controllers does this support? well? it's uh, new in development. a backend for the Pdk 13 with which is a 13 bit which is uh, the developers names for the 13-bit wide uh, program memory architecture. And like previous releases down here, they've actually added uh support for the Pdk 14 as they call it, the 14-bit wide memory and the 15-bit wide memory architectures as well.

Now if we go over to the Githubs for the free Pdk, as you can see, they've got the programmer software. They've got a code examples, they've got uh, looks like evaluation boards, and they've got documentation for the Uh programming architecture. Then they've got the program hardware which we've just built and uh, they've got an emulator as well Vhdl emulator to emulate the core. That seems pretty cool.

So yeah, you don't even need to buy the micros from Padauk. Um, you can put it in an Fpga I don't know. does anyone want to try that out? Give it a bell. They've got disassemblers as well and they got code examples and stuff like wow, Hats off to everyone who's uh, contributed to all this because it went from, you know, this weird obscure Asian brand uh, micro with yeah, you had to buy the programmer you had to use their quasi-c like uh compiler and that was it to.

now it's like it's com. They've practically completely opened the whole thing. Amazing. All right.

So if we go into code examples, over here, here we go. Um, this is from like two years ago. It's been around for quite some time. But let's try and just blink a ledge, shall we? Simple blinking program.

Um, so let's go to the simple blink sub sub directory. here. we've got our C program. That's it.
We don't want our projector pre. you know, we'll just like could. But anyway, we've just got our C program here. It is a simple blink program.

That's all it does. And look, it's incredibly simple. Then you've got port A C. I don't know what the labeling is.

Anyway, it's that port and that pin. So it doesn't matter whether you're using an eight pin product micro or using like a 14 pin one or whatever size chip you're using. it'll have all the just the different ports on there and you can choose whatever pins you want so that's actually bit three on there. and then you can use the pin out diagram of the chip to actually translate.

We've got that over here somewhere. Yep, that's over here. There you go. Pa3.

There you go is actually this pin down here. and I believe the eight pin chip will just, uh, use the bottom eight pins down there. So it's the same pin out so it's got Vcc and ground like that and on the 14 pin chip they're in the middle. but on the eight pin chip the pin out should be exactly the same.

So Pa3 will be this. pin that down in the bottom right corner down here and that's the pin that we're going to actually toggle. So we'll just download Sdcc here. Let's go to the download page Win64 That's the one we want version four because that supports the latest one.

You always want the latest, don't always want the latest version. Might be some obscure reason you might want to use an older version. But anyway, let's just run that and ah, set up nice. 300 other people have downloaded it.

Yeah, we want to include. Ah, there we go. Let's include support for everything. Shall we? There we go.

We can get uh, Pdk 13, 14, 15 and I don't know what The stack auto library is. no idea, but we want to insert should we like. You could just disable everything else, but it doesn't matter. I'm just going to go.

Yep. Install, Install. No workers and all. There's all the pick files.

There's all the header files. We'll see the Pdk header file shortly blinking. You miss it linking, you miss it. Missed it.

Oh, hang on. I looked at the simple Pdk code examples. is that different to the Sdcc Pdk code examples: Uh-huh Yep, I think this is the one we want. Kamagatsa Count: Poc151154: Don't know what chip I'm going to be using yet.

Let's do hello. a timer. let example. so it's going to flash.

Led? Is it for the I don't know, Um, it looks like uh, they've got like a demo board thing. so I don't have a demo board. I'm just programming the chip. So here's these uh, eval boards.

Let's go to the Sl8. Oh, it's just got schematic. No, what's uh, no? dot, sch. hmm no, let's not go there anyway.

Count Dot C. Let's have a look what's in there. A four bit counter for the Padauk. One Five One One Five Four One Six One, blah blah blah blah.
Count seconds from zero to three in binary using two leads on the lowest and highest ports of port A Written by Philip Kraus Cross and Klaus Cross. There's no way I'm going to pronounce that correctly. I'm sure. Anyway, standard Bull.h Okay, this is more your familiar C stuff.

so your C aficionados are going crazy. now. I'm actually starting to think that this simple Pdk code example that we looked at that is actually only going to work within the Paduck environment. so we don't really want that.

We want. uh, ones that work for Sdcc. Yeah, so it looks like we should be using this Sdcc Pdk example, which unfortunately is a bit more complicated to set stuff up. Now, if we go into the bin directory of what our Sdcc Sdcc compiler has installed, we'll find that like there's uh, S51 for example.

So that'll be the five one. Yep, uh. work. Yes, yeah.

helps if I type it right. S D A S P D K 15. boop. And there you go.

That looks like our assembly. That's the assembler written by Alan Baldwin. Good on you. Awesome effort.

Um, absolutely. No warranty implied. But uh, yeah. so this is what the compiler will call it'll.

call up this assembler, which actually it does and does the actual hardcore works. It'll actually call up this assembler when we, uh, tell it to target the product microcontrollers, it'll know to call this up. So unless you wanted to write Peduk assembly language, for example, because the whole idea of the C compiler is that the C compiler then converts it into assembly language and then the assembler actually compiles it into the binary. So yeah, it's just calling this up.

So unless you want the right assembly, you wouldn't muck around with this. But we can run our Sdcc and there it is there. Um, it's lots of options, lots of special options. Uh, we probably shouldn't have installed all of the micros.

We should have just installed the Paduk once. So there's the Z80. Uh, you know there's all different standards it supports for those playing along at home. If we go into our free Pdk section here, we can find the instruction set.

There you go. So let's go for the 15-bit instruction set. And oh, it's just a Html file that will give us the instruction set so we can download that. So there you go.

If we call that up, that's our 15-bit instruction set. Cool. Wow. Somebody's gone.

Hats off. That's a lot of effort to reconstruct that and get it right. I'm sure there are bugs in the early version, but you know, as people use it, it gets ironed out and it becomes rock solid. Sweet.

Unless they make changes to the hardware. So I thought I'd just have a googly search for integrated development environments for Sdcc. It looks like there's one. this sourceforge one.

Ide integration, Eclipse. Perhaps there's this Xanadu one down here. I don't know. Some hardware vendors create Id bundles supports for their hardware.
Uh, are the uh, Pinguino Ide bundle which is the pick version. What about this Xanadu and Ide for Sdcc any integrated for small device. C compiler sounds alright. Unfortunately this looks very old like latest commit was 2017.

but look, you know and I don't even think there's I don't think it's a Windows one. So System Requirements: Python Yeah, I yeah, nah. So I thought what I'd do is just I'll use Notepad Plus Plus here. I cut and pasted this code for this.

I don't expect it to work because I suspect it only works with the Padauk programmer. you know, Environment: quasi-c compiler. but it's worth a shot. Basically, you're just learning.

As I learn here, I'm just like going through until I get something that works. But the good thing about this is that this is how you can expect to. you know if you're in the same position I am. Oh, I want to use these uh, Paduk microcontrollers for something.

You know I've got a specific application. I've got to build up the hardware. We've got to download all the stuff and figure out how all this works. And of course it.

I just ran a simple with no parameters whatsoever and it simply did not like uh, test.c It just wouldn't pass it at all because we've got the dot in dot delay there so it doesn't like that. that's a product thing by the way. I looked in this timer Irq example which is an interrupt example and it seems to mix like here's some original code that they copied original mini C code and then they uh, looks like they're mixing. um like this is how you mix Asm you just go Asm Eng int don't know what that is.

Maybe Hello C I like the idea of hello C. Does it simulate a serial port or something? It outputs a string hello World at 9600 board One Stop it. That's what we want. Good on you Phillip, um with two peas.

Wow. So here's all the code. so this is like you know it's once again they're mixing Asm. They've got engine.

I don't know what that is here so it's not the world's simplest stuff like I'm not the world's best program like Sfr at address. You know I'm yeah, use factory calibration code and all this sort of stuff so it's not the it's not the easiest thing to use if you're a newbie, that's for sure. But anyway, um, it's going to use Printf. It's going to put like it's going to call the code.

It's going to assemble the code include the code for Printf. I don't know how much memory that will take because Printf is usually you know, quite a memory hog. Many times I've had to avoid using uh, Printf on small micros because of, you know, it can take one or two a couple of kilobytes of program memory just for printf for example. So yeah, you can really come a gutser on that.

So anyway, um, we seem to be able to use Printf here, but it's probably optimized. A good optimizing compiler will take out stuff you don't need and things like that. So anyway, I like. I like the idea of having a Hello World example running on my that outputs a serial port.
I think that's a very worthy example. so I'm going to copy that and we'll just paste that in here. There we go, and we'll save that as our test.c and I like that it's got color, syntax, highlighted and I can remember when that was introduced. That was a big thing.

You know color, syntax highlighting your code. so here we go. Let's try this again. I once again I've got no target whatsoever.

I haven't used Sdcc's before, but it seems to simply go in and at least first pass the code. Absolute address for Sfr Probably out of range. Probably? we don't care about probably's we deal in absolutes. Oh, now Seth deals in absolutes.

Um, probably out of rates. We don't care about that uh cast of literal value to generic pointer. I don't know. They're only warnings.

they're not errors. Uh, from type constant sign in literal I error for F Open failed to failed on file test Asm Yes, because we haven't specified. I presume. that's because we haven't specified an assembly target I.e a particular product or some other micro controller.

Z80 8051. Whatever it is, it's just compiled that C program for us. So that's what it does like. It compiles the C program and then it converts the C program into assembly language because we haven't told it a target.

It goes. What architecture do you want me to assemble this thing for? I could just, uh, you know, go for an example somewhere. Or maybe someone's got like a command line. uh, example.

But uh, help Vermont's execute. Actually, I like to execute verbosely, compile and assemble, but do not link. uh, preprocessor. Do we have to do dash M and then put Pdk or something because it's use the eg.

example of the Z80 and then you got to select the specific processor. Yeah, I can muck around with her from this for a while. I'll see if I can find a command line example just to do it just to get us started. That's the best way.

I mean, you know you can learn to do it by failing here? That's fine, but um, yeah, when in doubt Rtfm. So wow. If they've really gone to town on this, Um, it looks like though they have a wiki. so let's go over to the Wiki.

Oh ah, Wiki's Gonski. Oh well. maybe somebody didn't update that. Anyway, let's see if we can find some command line options.

So what I did is just search for the word Paduk and uh, there you go. Dash Mpdk13. Uh, for the fortune and I better figure out which one I'm doing it for. But let me just try the 15 bit wide one, shall we? So can we just do that and try it? Nope.

didn't like that test Asm. so ah, silly me, that's not for the Sdcc. That's the is that the linker or something? Yeah yeah, dumbass Dave. It's got specific uh, entries on Padauk, intrinsic name spaces and stuff like that.
Very nice. Looks like the Padoka's somehow tied to the 8051 type. Oh, that's it. That's it.

Where do we have Processor Target support? Processor selection options? There you go. That's what we want. Processor Command Line option? No, that's Esta That says star to manage libraries. No, Okay, we're back to where we were all right.

Looks like it's going to be more complicated than I thought. And of course, where else are you gonna find this? But the Eev blog forum which is I think pretty much where it all started with. uh, the original, uh, reverse engineering video from uh David too. It was experimenting with.

uh like you know, just looking at the signals from the product and I think it all sort of uh started to flow from there. Anyway, this is a message from Js, blah blah blah. lots of numbers. Um, and down here we've got an example commands to compile.

Here it is. Um, I I was right. Stcc, Mp Dk14 Oh, I didn't put the dash C, but I didn't have the extra stuff but I was. I was close.

I was close. So anyway, we should just be able to put that I guess. So if we do the example they got there Sdcc Mpdk15-c test Asm. It doesn't work and if you add in the dash o and test.rel or whatever it it just gives you the same thing.

And by the way, that line of 105 there where it's getting the error. The program is only 104 lines long. So 105th line is just basically saying that it can't fight it, can't open the file test Asm which it which is what it would have generated if it knew what processor target it was compiling for because you can't compile to an assembly file unless you know your processor target. Um, and I think, uh, Sdcc's just assumes it's 805 one target if you don't put anything.

Oh, I figured it out. It was simple. Um, I was actually running the program. I had my source file in the Windows Program Files subdirectory and I was calling that from there and that's actually a Windows protected subdirectory so it wasn't actually able to write.

It was Windows actually stopping it from being able to write to that same sub directory. So I just created a subdirectory called you know, slash A on my C drive and that's where I put my files and here we go. There we go. I just had test.c in there before.

Now I've got test.asm Test.list Desktop Real Test Dot Sim unbeliev dumbass Dave. So what we have to do here is this multi-step processor has produced this Rel file and then we're going to do it again. So then we just have to go test.rel like that and then the output. oh no, sorry, gotta take out the C there and then test.rel and then the output file.

Test dot uh I Hx which is the Intel Hex format file and that should work and we should now have Tada. There you go. 936 bytes in all its glory. For a hello World program that's pretty good when it's going to include like a printf thing.
Um, that's great. There's the Intel Hex file we can actually, uh, load that into here and it should actually display the hex file. There's our Intel Hex file, so that is what we can use to now program into our use. our programmer software, our programmer firmware embedded here put our chip in and then with the right right command line options in this.

then you do it of course. Yes, you could script and automate all this, and maybe there's already somebody out there who's done all this so that or if you had, as I said, an Ide in Integrated Development Environment specifically for well that supported product Micros and supported this, uh, particular open source hardware in support of the Sdcc and all that sort of jazz. Yeah, you could, uh, potentially, just like you know, push a single button, compile and download program. you know, and like in one hit.

literally one button press it could compile and then program uh in one hit. but it uses all these different command line tools to do that. But yeah, that's the value of scripting. So there you go.

That wasn't too hard at all. But yeah, you've got to know what you're doing. It's not trivial stuff, but you know, even dumbass Dave was able to figure it out. But as it turns out, I've actually got a uh, Pms-131 chip in here which cure in an 8-pin So package which curiously not even the data sheet has a pin out for.

it's got like the 14 pin uh packages he's got the 10 pin Msop and stuff like that. But anyway. Um, so I assume that this is like the 13 bit word architecture. This one's I got like a built-in 12-bit Adc and stuff like that.

So I'm going to do Mpdk-13 now. this is not uh, tested yet? not not like fully tested yet. So anyway, I'm going to recompile that. So I'm going to compile that.

There we go. and then I'm going to what do we do. Remove the compiler, put in the rail and then we put in the i like that ta-da And we should have our Ihex file for uh, no text text. I did.

Text should be test, don't anyway tag. That's appropriate. We did a printf text dot Ihex. Actually, I'm going to have to rerun that again for text dot confusing myself.

Anyway, this is for compile for the 13-bit architecture. So right. So we need to go back to our free Pdk, the programmer software. We're going to have to figure out how to run the command line for this now.

So here's our install readme and then it's got usage in here. Easy Pdk program option. and then you can read, write, erase, start, and stuff like that. So presumably if you've got an i don't know, do they have copy protection anyway, Um, yeah, you can read back and exist in.

So if you have a product that has a product micro in it, you can read back the the binary file from it. So so there we go. We specify our target and we can read and write. There we go.

That's what we want. Dash N what's dash N do I see name? There it is. Yep, I see name so presumably across my fingers. It supports my Uh 131 chip.
Now the thing is. where is the like executable? Where is the Windows executable? Well, now program a source. but I want a Windows executable make file. Don't hope I don't have to build it.

No hang on. I keep. I keep going. And sure enough browser open Github for easy releases.

Ah, did I not see that? Okay, I must not have res seen the releases. Awesome. Somebody's compiled it and released it. Fantastic.

Okay, I now have that unzipped easy Pdk prog and what do we need? Uh oh well. we can list. Uh first. There we go.

Oh, it supports the one Three Three One Three one, Pms One Three one. That's the one. I've got Beauty. So slash n Pms Pms131 right? Oh, this is exciting.

Text dot Ihex will it work? Um, it's got some Leds on it. I don't know. I don't know if the uh, the programming voltage hardware on here. we have still haven't tested that so I'm just going to go on for broke here.

Let's give it a bowl. Ah, right for this I see. Ah, Bloody Murphy, It's okay. I found my tubes of Pms One Five Ones.

Hopefully that works. They're eight pin so as well. All right, let's do this again. So I've got to recompile for the I assume it's the One Five the fifth I assumed the One Five one is the 15 bit architecture.

Probably a poor assumption on my part. But anyway, so I'll do that and then I'll So I'm doing test this time Rel And then I hex. I Hx no definition of area home data Oh, link Warning Internal version Error Oh that's interesting Dol Did I forget to put the dash C in there? I think I might have. I think that might make a difference.

Let's try it again. Okay, then we take out the C and we do the real and we go to the Ihex Ta-da we know chicken dinner. So we have test.i hex there. Yep, there it is.

437. Yep, and that's right about now. or you can see the date and time that I'm making this video. Yep, we're good to go because it's a four part video.

You might not see this for like a week or two. Who knows. So let's list again. Uh, Pms: One Five Four Oh C or B I've got C P M S One Five Four C I'm pretty sure that matters.

So One Five Four C right Test dot I hex fingers crossed. Um will it go flishy flash and will it write it Error Command Ack Failed Wrong. I sid oh I see Id wrong Ic Id ah what? Sorry It tried to read the Id from the chip and it didn't I guess is there a bad contact in my I got the So 8 adapter plugged in? I've got the chip around the right way. But yeah, these are the like.

All these little things are what you have to go through when you're using something like this for the first time or even coming back to it like I could do this. Now come back in three or six months time and forget how to do all this. I'd have to watch my own tutorial or go into someone else's You know it's it's just nuts. So no, or there could still be something wrong with the hardware we could.
Um, because I don't know about the programming voltages. Maybe it needs it. needs that to read out the needs of that to be working to read out the uh Id. Let's try it again, just in case.

No. Okay, definitely put in a 154c. Aha, people are probably screaming at me. Dave.

Look down this column here. The Pms-154c is a 14 bit in brackets. So there you go. I've come a gutter.

I assumed you remember how I said before. I assumed that the one five uh, you know one five X series would be the 15 bit. It's 14 bits and the one five four up here which has the flash. they're all 14 bits.

So I need to recompile again with the here. Here it is with the 14 right? and that's probably why I can only assume that's why here we go. So compile that again and then do that, Change it to one Four Test Rel Test intel hex. Okay, and now we can go to right that.

so let's try it again. By the way, there's one thing I noticed. all these chips have the numbers rubbed off them. There's nothing, well not rubbed off.

There's just no numbers on them, they're blank. Great if you want to copy protect your product. I guess. Well, it makes it harder, you know.

Anyway, here we go: Right angle. uh aha, we can use the probe command. There you go. Um, thank you very much.

Uh, Js. um all sorts of One through eight, Fifty five, Double A. I don't know what that means. This is awesome.

Um, you know this is what makes the Ev Love Forum great. It's basically uh, the community members on here who've developed a lot of this stuff and you know I couldn't find this anywhere else except the Eev blog forums. Absolutely amazing. I probably wouldn't have figured out all this all this myself.

So let's probe probe up the clacka. Probably nicey nothing found. So there you go. That's why it can't read the Id.

So there could be something wrong with my Uh. contacts with my So-8 adapter. Could be something wrong with the chip, but that's you know, unlikely because I got them directly from Lcsc. They're an authorized supplier even though they got no numbers on them.

Uh, which is a bit of a worry. Or the hardware. Um, there could be something wrong with the hardware that would be cool. I'd have to debug it.

I just tried. uh, the One Three one. I probed that and not nothing found. So yeah, Hardware? maybe? okay.

I tried to measure the Vcc pin on the chip when it, uh, like when I actually press program and I had to put in min max mode capture mode to capture that it only captured 0.55 volts. So yeah, I don't know if it's simply too fast for the multimeter to capture or whether or not. um, there's something wrong with the hardware. Winner.

Winner. You know what? Pms154 B C I guess they're identical. There you go, I see Id. Um, what it was is that.
Yep, dumbass Dave Mr. Joint. I missed it on the inspection and uh yeah, I soldered that joint properly. It was on the Dc to Dc converter, so that's one of the things that I didn't do in the previous hardware testing.

And yeah, Kamagatsa, see if you don't test it. Yep, Murphy will get you every time. Anyway, I thought I still had a problem because I tried it with the other chip, which I think is because it's unmarked the One Three One and it. It didn't probe it at all.

But then I put this one back in and it's working. So I don't know if the One Three One is just it just can't detect it or what's going on. so I don't know. so don't just assume that you've got a good chippity doo-dah in there.

I'll try it again. I think that's making contact, not nothing. Hmm. Anyway, the One Five One's a winner.

The One Five Four. There it is. So let's go back and try and write this. Shall we? Here we go.

Oh, there's no. there's no let's Oh, you may not be able to see that yet. Anyway, leads here. we go.

Done. I want. it's only one time. Pro Gamble.

I only get one shot at it. But done. Uh. The one Five without a letter on the end is a flash version because if you do this dot list, it actually tells you the only flash part or the only two flash parts.

One is the one, Five Four I don't know and the One Five Four C is the Uh and the B which we've got here Um, which has got uh, 2k words of memory by the way. And as you saw before, we use 900 and something uh, bytes. so we're using like half the memory just to do a hello World. These things are not designed for huge programs, but Printf takes a lot of space so you know you could.

If you hard coded that in like, you know, handwritten C or something like that, it'd be much better. All right. So this writes Hello World on pin Zero of Port A there. So if we go, have a look at our uh, chippity doo dah one, Five Four.

There we go. the eight Pin Jobby. Although they're all the same, it's all in Chinese Mandarin. you know, whatever.

Some people have complained that I call it Chinese, and it's actually, you know. Anyway, So there we go. Uh, Pin Zero, Pa Zero. So Pin Seven there.

So if we hook up, Vdd and Ground are these five volt taller and I can't actually remember. Um, so if we hook up five volts and ground, the good thing is is that because I've got it in my socket, I can just take that off and stick that in my breadboard and we can play with this thing. Although as luckily I've got a lot of chips because they're one time programmable only. but you can buy lots of chips when they only cost like a couple of cents each.

And yep, we can go to 5.5 volts. So there you go. Um, that's handy. So we should be able to hook this up and we should get Hello World out and we should be able to view that on the scope.
Let's give it a bill. Will it work after all this? How many videos is the fourth video? I haven't properly edited this yet, but this is probably the fourth video. It's like two hours worth of content or something. We're finally there.

Almost. you.

Avatar photo

By YTB

25 thoughts on “Eevblog #1306 4 of 5 : open source sdcc c compiler”
  1. Avataaar/Circle Created with python_avatars microcolonel says:

    It's cool what cheap things will motivate people to do.

  2. Avataaar/Circle Created with python_avatars Donald Pleasant says:

    IDE = Integrated Debugging Environment. Dave, you would know better if you were real.

  3. Avataaar/Circle Created with python_avatars gandei100 says:

    __asm … __endasm; was used to inline assembly code. 'engint' probably is enable global interrupt.

  4. Avataaar/Circle Created with python_avatars โ™ฅ๏ธ day says:

    Ms51PC0AE is available ?

  5. Avataaar/Circle Created with python_avatars EraYaN says:

    For anyone having a look now, PlatformIO supports the sdcc target (with Padauk targets). Which gives you a much nicer development/build environment.

  6. Avataaar/Circle Created with python_avatars Recycle Bin says:

    my guess is that you are running it on windows instead of on the chip, and OS's abstract away their address space so it throws warnings such as 'cast of literal value to generic pointer' but you can as you did just ignore or disable that warning.

  7. Avataaar/Circle Created with python_avatars irgski says:

    Iโ€™m a hw guy and all of this โ€œtrial and errorโ€ sw stuff drives me nuts!!!

  8. Avataaar/Circle Created with python_avatars neilw2O says:

    Have you tried using the up arrow a few times so you get your previous command lines. Might fix a few typos.
    Ah, a few retries later you used the up arrow. Forgotten how to use DOS?

  9. Avataaar/Circle Created with python_avatars DAVID GREGORY KERR says:

    What about Code::Blocks 16.02, you could try SDCC -80C51 test.c

  10. Avataaar/Circle Created with python_avatars Sandeep Kumar says:

    Padauk: STONKS

  11. Avataaar/Circle Created with python_avatars Gacheru Mburu says:

    ๐Ÿ‘

  12. Avataaar/Circle Created with python_avatars Bernadette Treual says:

    The 90s called and want their compiler back! Sorry, but no one outside of a museum should use SDCC.

  13. Avataaar/Circle Created with python_avatars Aurelio Rockdriguez says:

    I just checked that CodeBlocks can be used as IDE for SDCC and autodetects the compiler and its options for the different MCUs and MPUs ๐Ÿ™‚

  14. Avataaar/Circle Created with python_avatars Aurelio Rockdriguez says:

    I went thru the same process two months ago with SDCC, now I am loading binaries from a Compact Flash card or serial port to my Z80 computer ๐Ÿ™‚ great video!

  15. Avataaar/Circle Created with python_avatars Lars Bรธgild Thomsen says:

    Previous video and this, endless struggles with Windows issues – previous video: "If you are on Linux or Mac you are on your own" ๐Ÿ™‚

  16. Avataaar/Circle Created with python_avatars Gruftgrabbler says:

    I have the same error when using โ€˜easypdkprog probeโ€™. It simply says no programmer found but in โ€˜system informationโ€™ (Iโ€™m using macOS) the programmer is shown as โ€˜Easy PDK Programmerโ€™ correctly.

    Donโ€™t know whatโ€™s the problem. I have 2 programmers here and none of them works

  17. Avataaar/Circle Created with python_avatars Arnold C says:

    This one of my favorite video series of yours. I can't tell you how much it means for "young players" to watch even their EE heroes slip up with the little stuff some times. The single most important thing is perseverance and you're exemplifying that in this video series. Thank you Dave.

  18. Avataaar/Circle Created with python_avatars worroSfOretsevraH says:

    There was Pong game for PIC16C84.
    Composite out with sound in 1K of memory!

  19. Avataaar/Circle Created with python_avatars dipi says:

    Always use ยปputs ("Hello world")ยซ with constant strings (i.e. strings without interpolation directives like ยป%ยซ or ยป\โ€ฆยซ).
    It uses a tiny fraction of printf()'s memory footprint, and the end-of-line character is appended automatically.
    Cheers!

  20. Avataaar/Circle Created with python_avatars Paul Schuur says:

    Hi Dave, error 4 was a dead giveaway of the actual problem. If you'd type 'net helpmsg 4': "The system cannot open the file."

  21. Avataaar/Circle Created with python_avatars Alex Fedorov says:

    When easypdkprog said "Nothing found", I thought this all makes sense at last: 3 cents, no numbers, no die inside. )

  22. Avataaar/Circle Created with python_avatars cryptearth says:

    well – I guess this 1-8 is just junk – but 0x55AA is the signature for a classic master boot record …

  23. Avataaar/Circle Created with python_avatars Jorge Del Castillo says:

    Congratulations Dave. I've had a lot of fun…

    My first experience with Microchip OTP micros was in 1999 … those wonderful years.

  24. Avataaar/Circle Created with python_avatars RN1441 says:

    Watching this series of videos I'm reminded of the expression 'We can't afford to use free tools'. In this case the 3 cent chip is absolutely a great value if one needs to mill out tens of thousands of a product using it (e.g. greeting cards with audio?). For anything with a smaller unit run even up to the thousand units look like the time taken to get all of this right might be offset by the difficulty in getting all of this to work.

  25. Avataaar/Circle Created with python_avatars Ziferten says:

    I appreciate what you're doing, but I can't help thinking about the ATTiny10 in its SOT23-6 package, complete with 10 bit ADC, supported by AVR GCC, with 2K flash, available in single quantities for 0.33 USD. Is it worth the trouble?

Leave a Reply

Your email address will not be published. Required fields are marked *