Adaloader 32kb hex limit

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
signmaker
 
Posts: 10
Joined: Tue Jan 25, 2011 5:56 pm

Adaloader 32kb hex limit

Post by signmaker »

#Adafruit_Rick-- I see you have looked at these Adaloader issues alot. Please Help!
In the Adaloader file Optiloader.h, I can't seem to get the array to become larger than 32k.
I have tried various other data types with no luck. I have tried arduino 022,023 & 1.05. I've read many forum post. I have tried manually editing the hex so that it is intel 16byte. My hex file is large, it barely fits into the atmega644 I am trying to flash. I have read the correct signature from a avrisp mkII. I intend to use a arduino mega 2560 to burn ALOT, thousands, of atmega 644's. I am building a jig that can program many chips at once. The adaloader will compile, upload and properly burn a blink.pde to a atmega328. I think my last remaining problem is this size limit. In Westfields fork of the Arduino, several years old now, he points to this fault and claims a fix. It seems that Adaloader was created after his fix. Any suggestions are very appreciated.
Thanks,
Aleksei (Grissini) Sebastiani

Code: Select all

typedef struct image {
    char image_name[30];	       /* Ie "optiboot_diecimila.hex" */
    char image_chipname[12];	       /* ie "atmega168" */
    uint16_t image_chipsig;	       /* Low two bytes of signature */
    byte image_progfuses[5];	       /* fuses to set during programming */
    byte image_normfuses[5];	       /* fuses to set after programming */
    byte fusemask[4];
    uint16_t chipsize;
    byte image_pagesize;	       /* page size for flash programming */
    byte image_hexcode[33000];	       /*<--too large for the array- intel hex format image (text) */
} image_t;

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Adaloader 32kb hex limit

Post by adafruit_support_rick »

Probably a compiler limitation. Try concatenating two smaller arrays together in the struct:

Code: Select all

typedef struct image {
    char image_name[30];          /* Ie "optiboot_diecimila.hex" */
    char image_chipname[12];          /* ie "atmega168" */
    uint16_t image_chipsig;          /* Low two bytes of signature */
    byte image_progfuses[5];          /* fuses to set during programming */
    byte image_normfuses[5];          /* fuses to set after programming */
    byte fusemask[4];
    uint16_t chipsize;
    byte image_pagesize;          /* page size for flash programming */
    byte image_hexcode[30000];          /*<--too large for the array- intel hex format image (text) */
    byte extra_hexcode[3000];
} image_t;

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Adaloader 32kb hex limit

Post by pburgess »

Also possibly an AVR pointer limitation; might simply be impossible to declare an array over 32K, even if it's PROGMEM'd.

Couple other things to try:
1. Append 'L' to the image_hexcode size constant, i.e.:

Code: Select all

    byte image_hexcode[33000L];
2. If that doesn't work, maybe declare the array as a smaller number of a larger type, e.g.:

Code: Select all

    long image_hexcode[8250];
then cast to char as necessary.

3. Or maybe just declare it as a pointer rather than an array:

Code: Select all

    char *image_hexcode;

User avatar
signmaker
 
Posts: 10
Joined: Tue Jan 25, 2011 5:56 pm

Re: Adaloader 32kb hex limit

Post by signmaker »

Thanks for the good suggestions guys. I know that this is not a supported project from Adafruit and really appreciate the response.
I tried those suggestions but they didn't work out for me. Hopefully this information might help someone smarter in the future.
///////////////////////////////////////////////////////////////////////////////////////////////
Rick's suggestion
With concatenating the string, I first received the error:
"initializer: string for array of chars is too long"

Then with most code commented out the error is:
"size of variable image 'image_328' is too large"

----my hex code goes from 0000 to CD83

////////////////////////////////////////////////////////////////////////////////////////////////////
Phil's suggestions:

1. Adding the L

Code: Select all

byte image_hexcode[33000L];
"Overflow in array dimension"

2.

Code: Select all

long image_hexcode[8000];
in the line of code in the file adaloader.pde

Code: Select all

byte *hextext = targetimage->image_hexcode;  
cannot convert long int* to byte in initialization

Code: Select all

 
//getting bigger now
long image_hexcode[8250];
size of array 'image_hexcode' is too large
I commented out all but a few lines-same result
I looked from non complete line-still does it

Code: Select all

//testing the limits
long image_hexcode[33000];
overflow in array dimension

3. Pointers-- I like this idea alot, but coundn't seem to change enough of the variables to jive. Is there a way to cast that would get things to play nice?

Code: Select all

long *image_hexcode;
coudn't convert long to byte here

Code: Select all

byte *hextext = targetimage->image_hexcode;  
cannot convert long int* to byte in initialization

and if I convert that byte pointer it goes to

Code: Select all

 byte *hextextpos = readImagePage (hextext, pageaddr, pagesize, pageBuffer);
cannot convert long to byte

when I start converting a bunch of these bytes to longs I get to a point where I get stuck. It seems like a bad idea and practice anyway.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Adaloader 32kb hex limit

Post by adafruit_support_rick »

Signmaker wrote:Rick's suggestion
With concatenating the string, I first received the error:
"initializer: string for array of chars is too long"
You have to split it into two initializers - you can't just give it a single initializer.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”