WestfW/OptiLoader — Issue #4: avr-gcc 4.6.2 compilation problem
Author: kermitas
Created: 2012-02-28 15:50:54+00:00
State: open

Arduino 1.0

avr-gcc (Fedora 4.6.2-1.fc16) 4.6.2

Compiling causes a lot of problems about missing "const" words.

Those are my changes that fix this.

OPTILOADER.H
1)

// Forward decl
extern const image_t PROGMEM image_328, image_328p, image_168, image_8;

OPTILOADER.PDE
1)
void read_image(const image_t *ip);

2)

/*
* Table of defined images
*/
const image_t *images[] = {
&image_328, &image_328p, &image_168, &image_8, 0
};

3)
image_t const *target_flashptr; /* pointer to target info in flash */

4)

/*
* read_image
*
* Read an intel hex image from a string in pgm memory.
* We assume that the image does not exceed the 512 bytes that we have
* allowed for it to have. that would be bad.
* Also read other data from the image, such as fuse and protecttion byte
* values during programming, and for after we're done.
*/
void read_image (const image_t *ip)
{
uint16_t len, totlen=0, addr;
const char *hextext = &ip->image_hexcode[0];
target_startaddr = 0;

5)

/*
* target_findimage
*
* given target_type loaded with the relevant part of the device signature,
* search the hex images that we have programmed in flash, looking for one
* that matches.
*/

boolean target_findimage ()
{
// tutaj skasowalem linie image_t *ip;

fp("Searching for image...\n");
for (uint8_t i=0; i < sizeof(images)/sizeof(images[0]); i++) {
//target_flashptr = images[i];

const image_t *ip = images[i];
target_flashptr = images[i];

if (ip && (pgm_read_word(&ip->image_chipsig) == target_type)) {
fp(" Found \"");
flashprint(&ip->image_name[0]);
fp("\" for ");
flashprint(&ip->image_chipname[0]);
fp("\n");
read_image(ip);
return true;
}

}
fp(" Not Found\n");

return(false);
}

Thanks,
Arthur.