Hallo locutus.
Danke für die schnelle Antwort. Ja müsste wohl so sein.
Kann ich irgendwie den Stream von Siow aufzeichnen damit ich das nachvolziehen kann? Bin noch am Lernen und noch micht 1 mit der hex "ebene"

Dann werde ich mal den aufbau der hex Files studieren.
Hänge noch die funktion des ex_usb_bootloaders an die das schreiben übernimmt. Vieleicht fällt jemanden was auf.
void load_program(void)
{
int1 do_ACKLOD, done=FALSE;
int8 checksum, line_type;
int16 l_addr,h_addr=0;
int8 to;
int32 addr;
int8 dataidx, i, count;
int8 data[32];
int buffidx;
char buffer[BUFFER_LEN_LOD];
while (!done) // Loop until the entire program is downloaded
{
usb_task();
if (!usb_cdc_kbhit())
continue;
buffidx = 0; // Read into the buffer until 0x0D ('\r') is received or the buffer is full
to = 250; //250 milliseconds
do
{
if (!usb_cdc_kbhit())
{
delay_ms(1);
to--;
if (!to)
break;
}
else
to = 250;
i = usb_cdc_getc();
buffer[buffidx++] = i;
} while ( (i != 0x0D) && (i != 0x0A) && (buffidx <= BUFFER_LEN_LOD) );
if (!to)
continue;
usb_cdc_putc(XOFF); // Suspend sender
do_ACKLOD = TRUE;
// Only process data blocks that start with ':'
if (buffer[0] == ':') {
count = atoi_b16 (&buffer[1]); // Get the number of bytes from the buffer
// Get the lower 16 bits of address
l_addr = make16(atoi_b16(&buffer[3]),atoi_b16(&buffer[5]));
line_type = atoi_b16 (&buffer[7]);
addr = make32(h_addr,l_addr);
// If the line type is 1, then data is done being sent
if (line_type == 1)
{
done = TRUE;
}
else if ((addr >= (int32)APPLICATION_START) && (addr < ((int32)0x300000)))
{
checksum = 0; // Sum the bytes to find the check sum value
for (i=1; i<(buffidx-3); i+=2)
checksum += atoi_b16 (&buffer[i]);
checksum = 0xFF - checksum + 1;
if (checksum != atoi_b16 (&buffer[buffidx-3]))
do_ACKLOD = FALSE;
else
{
if (line_type == 0) {
// Loops through all of the data and stores it in data
// The last 2 bytes are the check sum, hence buffidx-3
for (i = 9,dataidx=0; i < buffidx-3; i += 2)
data[dataidx++]=atoi_b16(&buffer[i]);
rom_w(addr, data, count);
}
else if (line_type == 4)
h_addr = make16(atoi_b16(&buffer[9]), atoi_b16(&buffer[11]));
}
}
}
if (do_ACKLOD)
usb_cdc_putc (ACKLOD);
usb_cdc_putc(XON);
}
usb_cdc_putc (ACKLOD);
usb_cdc_putc(XON);
delay_ms(2000); //give time for packet to flush
reset_cpu();
}