print boot/app info from blctrls on startup

This commit is contained in:
Olaf Rempel 2008-02-18 21:40:20 +01:00
parent 6422cf0bd8
commit 4e0f66eb01
3 changed files with 31 additions and 16 deletions

View File

@ -72,7 +72,7 @@ clean:
openocd: openocd:
$(shell $(OPENOCD) -f scripts/openocd.cfg) $(shell $(OPENOCD) -f scripts/openocd.cfg)
install: install: all
./scripts/download.sh ./scripts/download.sh
-include $(shell find $(BUILD) -name *.d 2> /dev/null) -include $(shell find $(BUILD) -name *.d 2> /dev/null)

3
main.c
View File

@ -82,14 +82,13 @@ int main(void)
/* twi */ /* twi */
at91_twi_init(); at91_twi_init();
at91_twi_test();
/* usb */ /* usb */
at91_udp_init(); at91_udp_init();
printf("static alloc: %5ld bytes\n\r", static_alloc_used()); printf("static alloc: %5ld bytes\n\r", static_alloc_used());
at91_twi_test();
pitc_schedule_timer(&pitc_test_timer); pitc_schedule_timer(&pitc_test_timer);
while (1); while (1);

View File

@ -189,26 +189,42 @@ void at91_twi_test(void)
{ {
uint32_t i; uint32_t i;
for (i = TWI_ADDR_BL1; i <= TWI_ADDR_BL4; i++) { for (i = TWI_ADDR_BL1; i <= TWI_ADDR_BL4; i++) {
uint8_t buf[16];
struct blmc_cmd cmd = { struct blmc_cmd cmd = {
.cmd = CMD_GET_INFO, .cmd = CMD_BOOT_LOADER,
.mode = BLMC_CMD_READ | BLMC_CMD_0_ARG, .mode = BLMC_CMD_WRITE | BLMC_CMD_0_ARG,
.size = sizeof(buf),
.data = buf,
}; };
uint32_t ret = twi_cmd(i, &cmd);
printf("twi[0x%02lx](%ld) ", i, ret);
uint32_t retval = twi_cmd(i, &cmd); volatile uint32_t x;
printf("twi(0x%02lx): %ld '%s' ", i, retval, buf); for (x = 0; x < 200000; x++);
uint8_t buf[16];
cmd.cmd = CMD_GET_INFO,
cmd.mode = BLMC_CMD_READ | BLMC_CMD_0_ARG,
cmd.size = sizeof(buf),
cmd.data = buf,
ret = twi_cmd(i, &cmd);
printf("boot(%ld):'%s' ", ret, buf);
cmd.cmd = CMD_GET_SIGNATURE; cmd.cmd = CMD_GET_SIGNATURE;
cmd.size = 4; cmd.size = 4;
twi_cmd(i, &cmd); ret = twi_cmd(i, &cmd);
printf("(sig: 0x%02x%02x%02x)\n\r", buf[0], buf[1], buf[2]); printf("sig(%ld):0x%02x%02x%02x ", ret, buf[0], buf[1], buf[2]);
cmd.cmd = CMD_BOOT_APPLICATION; cmd.cmd = CMD_BOOT_APPLICATION;
cmd.mode = BLMC_CMD_WRITE | BLMC_CMD_0_ARG; cmd.mode = BLMC_CMD_WRITE | BLMC_CMD_0_ARG;
cmd.size = 0; cmd.size = 0;
twi_cmd(i, &cmd); ret = twi_cmd(i, &cmd);
for (x = 0; x < 200000; x++);
cmd.cmd = CMD_GET_INFO,
cmd.mode = BLMC_CMD_READ | BLMC_CMD_0_ARG,
cmd.size = sizeof(buf),
cmd.data = buf,
ret = twi_cmd(i, &cmd);
printf("app(%ld):'%s'\n\r", ret, buf);
} }
} }