I don't have a complete Code nor binary to dump out the whole firmware as I couldn't even get the test bytes out at a reasonable speed and I started without all the protocol and CRC stuff to keep the binary small.
Here is the code that works just blinks the ASCII characters 0 through 9 followed by "\n\r":
#define MIN_ADDRESS 0xFF810000
#define FW_SIZE 0x400000
#define START_SECTOR 2048
#define LED_PR 0xC0220134
#define LED_AF 0xC0223030
void led_on()
{
volatile long *p=(void*)LED_PR;
*p=0x46;
p=(void*)LED_AF;
*p=0x46;
}
void led_off()
{
volatile long *p=(void*)LED_PR;
*p=0x44;
p=(void*)LED_AF;
*p=0x44;
}
void send_byte(long b)
{
#define DELAY_SYNC (45 * 500)
#define DELAY_SPACE (50 * 500)
#define DELAY0 (1 * 500)
#define DELAY1 (25 * 500)
#define nop() asm("nop\n")
#define on() *led=0x46
#define off() *led=0x44
#define delay(value) \
for (i=0; i<value; ++i) { \
nop(); \
nop(); \
}
#define do_bit(i) \
on(); \
if (b&(1<<i)) { \
delay(DELAY1); \
} else { \
delay(DELAY0); \
} \
off(); \
delay(DELAY_SPACE);
volatile long *led = (void*)LED_AF;
int i;
delay(DELAY_SYNC);
// data bits
do_bit(0);
do_bit(1);
do_bit(2);
do_bit(3);
do_bit(4);
do_bit(5);
do_bit(6);
do_bit(7);
}
void __attribute__((noreturn)) my_restart()
{
send_byte('0');
send_byte('1');
send_byte('2');
send_byte('3');
send_byte('4');
send_byte('5');
send_byte('6');
send_byte('7');
send_byte('8');
send_byte('9');
send_byte(13);
send_byte(10);
while(1);
}
Adjust the DELAY* macros to make it faster/slower.
It should be save to declare any variable that points to the LED as volatile. It should even be save to declare
any variable as volatile, it will make the code slower in theory, but I doubt you'll ever notice in practice and it shouldn't do any harm.
http://rohrpostix.org/~thomas/PS.FI2 is built
without the factor of 500 for the delays, which is just the way the original blinker by grand does it. If your hardware is fast enough to correctly sample the bytes, you can try inserting all of the blinker code to dump the firmware. If you need help with this, I can provide the precompiled blinker firmware for you.