Help me name my new Arduino core!

Hi! I'm planning to create a simple Arduino core where Majek's modified version of Optiboot is used. The supported microcontrollers will be:

  • ATmega48*
  • ATmega8*
  • ATmega88*
  • ATmega168
  • ATmega328
  • including the A, V, P and PA version

With selectable clock frequencies such as

  • 16 MHz
  • 20 MHz
  • 8 MHz
  • 1 MHz
    (Am I missing some?)

These microcontrollers are already heavily supported by the IDE by default (well, almost all), but they are hidden behind names such as Arduino UNO, Arduino Duemilanove and Arduino NG. By default there's just a 16 MHz version of the Optiboot bootloader, and you'll have to do all the heavy lifting yourself if you want to do some changes. My idea was to compile a bunch of bootloaders and create a rather advanced boards.txt file where all the options can be selected. There will not be a separate copy of the core; the boards.txt will refer to the AVR core that's already included in the IDE.

It's going to be a simple and useful core if you want to experiment with different microcontrollers and clock frequencies with your Arduino UNO.

For me the hard part is to figure out a great name. I've already created MightyCore and MegaCore, so I want to stick with this style. I was thinking of names such as BasicCore or CommonCore, but these are just so lame! Can you help me find a suitable name? :slight_smile:

If I recall correctly the bootloader (Optiboot in this case) "tricks" avrdude into believing an ATmega328 actually is an ATmega328p by "changing" the device signature. Is this correct? I was planning to make a "variant" option in the boards menu where one can select the ATmega328 or ATmega328p, but if the bootloader handles this there's no need to make an extra menu option

As I understand it, Optiboot reports the chip signature when avrdude requests it, but it does not read the signature value from the chip, it simply has the signature hard coded in Optiboot and uses that. So you should be able to make a custom Optiboot that outputs whatever signature you want (not that you would want it to report the actual signature for ATmega328, because that would complicate things more than help, but who knows). FlashyCore or MajeKore.

Will it support PB too? :wink:

You want 12mhz on the frequency list too, I'd say.

How about "MedioCore" (pronounced "mediocre")?

Or MiniCore? (in reference to how the arduino mini and many other small boards used the 328p?) Would go well with MightyCore and MegaCore

So you're thinking adding capability like was done for the 1284s to make it easy to manipulate the fuse settings?

I think that would be neat. Maybe Mighty328familyCore as that's the datasheet they are coming from? (well, the 328 family of data sheets, as there is a different sheet for the Automotive parts with extended temperature range (Atmega328P-15AZ & -15MZ)

Or MiniCore? (in reference to how the arduino mini and many other small boards used the 328p?) Would go well with MightyCore and MegaCore

MiniCore is a great name! :slight_smile: It goes well with MightyCore and MegaCore as well! 12 MHz will be an option too

So you're thinking adding capability like was done for the 1284s to make it easy to manipulate the fuse settings?

Yes, it will almost be identical to the boards meny found in MightyCore, where BOD settings and clock frequencies can be manipulated.

It seems like the ATmega48 would be a hard nut to crack; It doesn't got a boot section like the rest of the family. I think the easiest would be to just skip the bootloader on this one and program it using an ISP instead

You could try VIRTUAL_BOOT_PARTITION option of Optiboot for Atmega48, but it could be tricky to get reliable entry point to flash write function.
I'm thinking about some kind of revolution: get rid of version number in 2 last bytes of flash (nobody uses this anyway) and put there jump to do_spm. It could be really constant for every chip, bootloader features and sizes. And it could save another 2 bytes of code :slight_smile:

MiniCore is good idea. I thought also about HardCore as code writing to it's own flash is some kind of risky/advanced/hardcore thing :slight_smile:

TinyCore eventually for Attiny 24/44/84, 25/45/85, and 2313?

I'm thinking about some kind of revolution: get rid of version number in 2 last bytes of flash (nobody uses this anyway) and put there jump to do_spm. It could be really constant

No! Having a version number is really important! You're welcome to put the do_spm vector in FLASHEND-4

Just an idea, why not using classic stuff: mega, kilo, hecto, deca, mili, micro, nano, pico, femto.
Maybe the name of someone of the great: Ohm, Faraday, Tesla, Volta, Newton, Einstein, Feynman.
Anyway, is just in terms of aesthetics right? :slight_smile:

ok, maybe you guys can help me out on this one. I was able to get my hands on an ATmega328 (non p) today. I compiled the bootloader (edited the makefile from 328p to 328) and burned the bootloader using a modified boards.txt file. The bootloader is burnt, and everything is fine, but when I try to upload a sketch, I get this error:

avrdude: Device signature = 0x1e950f
avrdude: Expected signature for ATmega328 is 1E 95 14
         Double check chip, or use -F to override this check.

The bootloader pretends to be an ATmega328p, and AVRdude returns an error. Adding -F is a dirty workaround, so I want to avoid doing that if possible.

How can I get the bootloader to return the actual device signature? This problem will appear on the ATmega88/p and ATmega168p/pa as well. :frowning:

hansibull:
ok, maybe you guys can help me out on this one. I was able to get my hands on an ATmega328 (non p) today. I compiled the bootloader (edited the makefile from 328p to 328) and burned the bootloader using a modified boards.txt file. The bootloader is burnt, and everything is fine, but when I try to upload a sketch, I get this error:

avrdude: Device signature = 0x1e950f

avrdude: Expected signature for ATmega328 is 1E 95 14
        Double check chip, or use -F to override this check.




The bootloader pretends to be an ATmega328p, and AVRdude returns an error. Adding -F is a dirty workaround, so I want to avoid doing that if possible.

How can I get the bootloader to return the actual device signature? This problem will appear on the ATmega88/p and ATmega168p/pa as well. :(

modify the bootloader to actually read the signature. Right now it just returns the #defines for whatever part Optiboot was compiled for. Those SIGNATURE_0/1/2 come from the avrlibc includes.

    else if(ch == STK_READ_SIGN) {
      // READ SIGN - return what Avrdude wants to hear
      verifySpace();
      putch(SIGNATURE_0);
      putch(SIGNATURE_1);
      putch(SIGNATURE_2);
    }

I saw a function somewhere in there to get sig bytes... I think it's just a matter of calling that instead of using the defines...

Of course! what registers holds the device signature? Every guide I've read refers to the io.h file :frowning:

EDIT:
I found an old post from AVR freaks where mr. westfw (aka the father of optiboot(?)) posted an Arduino sketch where he used boot.h to read the signature bytes. When I try to implement his method (shown in the code below) I just get an error saying that SIGRD isn't defined. When I define it (like in the example sketch) I get the error message below:

else if(ch == STK_READ_SIGN) {
      // READ SIGN - return what Avrdude wants to hear
      verifySpace();
      
      uint8_t tempval = boot_signature_byte_get(0); //variable to store device signature bytes
      putch(tempval);//SIGNATURE_0);
      
      tempval = boot_signature_byte_get(2);
      putch(tempval);//SIGNATURE_1);
      
      tempval = boot_signature_byte_get(4);
      putch(tempval);//SIGNATURE_2);
    }

$ make atmega328 AVR_FREQ=16000000L BAUD_RATE=115200 UART=0 LED=B5 LED_START_FLASHES=2
avr-gcc (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

BAUD RATE CHECK: Desired: 115200, Real: 117647, UBRRL = 16, Error=2.1%
avr-gcc -g -Wall -Os -fno-split-wide-types -mrelax -mmcu=atmega328 -DF_CPU=16000000L -DBAUD_RATE=115200 -DLED_START_FLASHES=2 -DLED=B5 -c -o optiboot.o optiboot.c
optiboot.c:306:6: warning: #warning BAUD_RATE error greater than 2% [-Wcpp]
#warning BAUD_RATE error greater than 2%
^
avr-gcc -g -Wall -Os -fno-split-wide-types -mrelax -mmcu=atmega328 -DF_CPU=16000000L -DBAUD_RATE=115200 -DLED_START_FLASHES=2 -DLED=B5 -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe -Wl,--relax -nostartfiles -nostdlib -o optiboot_atmega328.elf optiboot.o -lc
/usr/local/CrossPack-AVR-20131216/lib/gcc/avr/4.8.1/../../../../avr/bin/ld: section .version loaded at [00007ffe,00007fff] overlaps section .text loaded at [00007e00,00008005]
collect2: error: ld returned 1 exit status
make: *** [optiboot_atmega328.elf] Error 1
rm optiboot.o

Yeah, it's not compiling to under 510 bytes anymore (the last 2 are used for a version number). It looks like with the code to read the signature bytes, it's coming out to 518 bytes. Gotta lose 8 bytes somehow...

Damn it! I'm no bootloader guru :frowning: I don't watch to use the bigboot option either, which allocates another 512b. I guess I'm stuck for now

Couldn't you just use the same system of defining the chip in the makefile and then having the bootloader pass the signature associated with the chip it was compiled for? So there would be different bootloader files for ATmega328P and ATmega328? That shouldn't cause any increase in size.

There is this sketch. It's pretty old; I don't know whether it still works (it does compile :slight_smile: )

Pretty-Prints fuses, signature, serial number (Are they still doing that?) and (maybe) Optiboot version info...

Thanks! I'll be back with more info when the test microcontrollers have arrived and the core us up and running on Github. BTW the name I chose was MiniCore :smiley: