print boot/app info from blctrls on startup
This commit is contained in:
parent
6422cf0bd8
commit
4e0f66eb01
2
Makefile
2
Makefile
@ -72,7 +72,7 @@ clean:
|
||||
openocd:
|
||||
$(shell $(OPENOCD) -f scripts/openocd.cfg)
|
||||
|
||||
install:
|
||||
install: all
|
||||
./scripts/download.sh
|
||||
|
||||
-include $(shell find $(BUILD) -name *.d 2> /dev/null)
|
||||
|
3
main.c
3
main.c
@ -82,14 +82,13 @@ int main(void)
|
||||
|
||||
/* twi */
|
||||
at91_twi_init();
|
||||
at91_twi_test();
|
||||
|
||||
/* usb */
|
||||
at91_udp_init();
|
||||
|
||||
printf("static alloc: %5ld bytes\n\r", static_alloc_used());
|
||||
|
||||
at91_twi_test();
|
||||
|
||||
pitc_schedule_timer(&pitc_test_timer);
|
||||
|
||||
while (1);
|
||||
|
@ -189,32 +189,48 @@ void at91_twi_test(void)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = TWI_ADDR_BL1; i <= TWI_ADDR_BL4; i++) {
|
||||
uint8_t buf[16];
|
||||
struct blmc_cmd cmd = {
|
||||
.cmd = CMD_GET_INFO,
|
||||
.mode = BLMC_CMD_READ | BLMC_CMD_0_ARG,
|
||||
.size = sizeof(buf),
|
||||
.data = buf,
|
||||
.cmd = CMD_BOOT_LOADER,
|
||||
.mode = BLMC_CMD_WRITE | BLMC_CMD_0_ARG,
|
||||
};
|
||||
uint32_t ret = twi_cmd(i, &cmd);
|
||||
printf("twi[0x%02lx](%ld) ", i, ret);
|
||||
|
||||
volatile uint32_t x;
|
||||
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);
|
||||
|
||||
uint32_t retval = twi_cmd(i, &cmd);
|
||||
printf("twi(0x%02lx): %ld '%s' ", i, retval, buf);
|
||||
|
||||
cmd.cmd = CMD_GET_SIGNATURE;
|
||||
cmd.size = 4;
|
||||
twi_cmd(i, &cmd);
|
||||
printf("(sig: 0x%02x%02x%02x)\n\r", buf[0], buf[1], buf[2]);
|
||||
|
||||
ret = twi_cmd(i, &cmd);
|
||||
printf("sig(%ld):0x%02x%02x%02x ", ret, buf[0], buf[1], buf[2]);
|
||||
|
||||
cmd.cmd = CMD_BOOT_APPLICATION;
|
||||
cmd.mode = BLMC_CMD_WRITE | BLMC_CMD_0_ARG;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void at91_twi_init(void)
|
||||
{
|
||||
/* enable Clock */
|
||||
/* enable Clock */
|
||||
*AT91C_PMC_PCER = (1 << AT91C_ID_TWI);
|
||||
|
||||
/* SDA & SCL from Peripheral A, Open Drain, no Pullup */
|
||||
|
Loading…
Reference in New Issue
Block a user