My code wasn't working, and it took me quite a while to figure out why. I ended 
up having to install ST's Visual Develop IDE so that I could use the debugger 
and step through the executing code.

The mistake was on this line:

ldf ([_flash_write_block_addr_tmp], x), a

I forgot to take into account that 'addr_tmp' was a 32-bit variable, so the 
address the symbol represents would be pointing to the highest byte, which will 
always be zero for a 24-bit address! If for example the address was 0x00027F80, 
that code would be trying to write to 0x00027F, which is RAM, not flash!

I need to shift the address along one byte, so that line should in fact be:

ldf ([_flash_write_block_addr_tmp+1], x), a

With that it all works properly. :-)

Regards,
Basil
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to