How to compile code for ATmega8? - now I find I have an ESP01-S

More
6 months 2 weeks ago #12871 by meq123
I (seem to) recall that the mega8 was a suitable replacement for the m328 in the classic clocks, but in trying to compile the code for a mega8 chip I came across a couple of issues and am now blocked.

The first issue was the following error for the WDTO:
D:\NixieFirmwareV2_v358_mods\FirmwareV2\FirmwareV2.ino: In function 'void setup()':
FirmwareV2:775:14: error: 'WDTO_8S' was not declared in this scope
   wdt_enable(WDTO_8S);
              ^~~~~~~

On researching it, I found that the '8S' value was not supported on mega8's. Hmm. So I changed the code to say: wdt_enable(WDTO_2S);. When I recompiled, I got the second error:
Linking everything together...
[...]
c:/users/bldr/appdata/local/arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld.exe: D:\Temp\arduino_build_859658/FirmwareV2.ino.elf section `.text' will not fit in region `text'
c:/users/bldr/appdata/local/arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld.exe: region `text' overflowed by 17962 bytes
collect2.exe: error: ld returned 1 exit status

Does this imply the mega8 does not have enough memory and I'm SOL? And/or can you suggest a workaround or fix?

Thanks, Mark

Please Log in or Create an account to join the conversation.

More
6 months 2 weeks ago #12872 by meq123
Well, now I see the mega8 only has 8K of rom, so I guess I *AM* SOL. Bugger. I bought 5 of these. :(

Please Log in or Create an account to join the conversation.

More
6 months 2 weeks ago #12873 by Ty_Eeberfest
Not an AVR expert but I do know a thing or two...

I think you are indeed SOL. The clock program is supposed to be compatible with Arduino UNO. I found I had a schematic (old) of an UNO that showed it having a mega8 as its main processor. Further research tells me the UNO was changed to mega328P a long time ago, so when code claims to be UNO compatible it's most likely needing a mega328P unless it's super old.

Just out of curiosity what board are you telling the IDE to use? I could try compiling it myself if I knew your board config.

Look into it later when the dust is clearing off the crater.

Please Log in or Create an account to join the conversation.

More
6 months 2 weeks ago #12874 by Ian
There are a couple of points to take into account here:

The memory is too small for the code we have, you'll have to cut it down quite a bit. It IS possible to make a working clock with an A8, but you'll have to throw a lot of features overboard. At the end of it, you can achieve something like the Chinese cheap clocks you can get: It will tell the time, it won't tell the date, won't do dimming, fading or any of that other stuff. But it can work.

The clock speed is also lower (16MHz vs. 20Mhz), but that's neither here nor there, we only run at 16, a hangover from the Arduino era.

And if I recall correctly, the PWM is limited - there is only 1 channel, (or maybe none at all - I don't remember more than PWM not being full fat), so you'll have to find another way of controlling backlights.

I know this because I did a project with A8 that never made it out of the lab:

bitbucket.org/isparkes/singledigitnixiemodule/src/master/

This implements the full fade/dim/NeoPixel backlights thing, but for only one digit - I was what I was aiming for on that project, and to achieve it, I had to make compromises. I don't remember what they were, but I do remember code size was always the limiting factor.

Also, you have to lose a bit (256 bytes) for the boot loader IIRC.

Of course, you could always do it in assembler and squeeze some more features in... That would be an interesting project.

Please Log in or Create an account to join the conversation.

More
6 months 2 weeks ago - 6 months 2 weeks ago #12886 by meq123
Thanks for your replies guys, I figgerd I was SOL when I saw the rom size :(

Ty_Eeberfest wrote: Not an AVR expert but I do know a thing or two...
Just out of curiosity what board are you telling the IDE to use? I could try compiling it myself if I knew your board config.


I was using a tinyUSB as the programmer and configuring mini core and ATmega8 as the 'board'. But as Ian says, it's a highway to nowhere.

Ian wrote: There are a couple of points to take into account here:

The memory is too small for the code we have, you'll have to cut it down quite a bit. It IS possible to make a working clock with an A8, but you'll have to throw a lot of features overboard. At the end of it, you can achieve something like the Chinese cheap clocks you can get: It will tell the time, it won't tell the date, won't do dimming, fading or any of that other stuff. But it can work.

The clock speed is also lower (16MHz vs. 20Mhz), but that's neither here nor there, we only run at 16, a hangover from the Arduino era.

And if I recall correctly, the PWM is limited - there is only 1 channel, (or maybe none at all - I don't remember more than PWM not being full fat), so you'll have to find another way of controlling backlights.

I know this because I did a project with A8 that never made it out of the lab:

bitbucket.org/isparkes/singledigitnixiemodule/src/master/

This implements the full fade/dim/NeoPixel backlights thing, but for only one digit - I was what I was aiming for on that project, and to achieve it, I had to make compromises. I don't remember what they were, but I do remember code size was always the limiting factor.

Also, you have to lose a bit (256 bytes) for the boot loader IIRC.

Of course, you could always do it in assembler and squeeze some more features in... That would be an interesting project.


Thanks, Ian, for that comprehensive reply. I *had* thought about converting this to assembler earlier (before this) but it would take far too much time as I'm building this clock as a Christmas present. Fortunately, I have (one) spare 328 I can use for this one, so all is not lost. I need to order more 328's, but stocks are low.

Thanks again guys!
Last edit: 6 months 2 weeks ago by meq123.

Please Log in or Create an account to join the conversation.

More
6 months 2 weeks ago #12887 by meq123
So, I'm ditching the mega8's to the parts drawer, and was just sitting down to program the ESP-01, where I find that the one I have (from eBay I think) is an ESP-01S. I recall seeing about issues with those, and I searched the forum again only to find horror stories and "stay-aways"!

Unfortunately this is the only one I have, so unlikely to get a correct one before Xmas. Is there any way I can make this work - adding wires, removing LEDs, changing code? Anything?

Thanks,
-Mark

Please Log in or Create an account to join the conversation.

Moderators: AccutronTy_EeberfestIan
Time to create page: 0.100 seconds
Go to top
JSN Boot template designed by JoomlaShine.com