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:
|
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
3
main.c
@ -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);
|
||||||
|
@ -189,32 +189,48 @@ 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);
|
||||||
|
|
||||||
|
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.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void at91_twi_init(void)
|
void at91_twi_init(void)
|
||||||
{
|
{
|
||||||
/* enable Clock */
|
/* enable Clock */
|
||||||
*AT91C_PMC_PCER = (1 << AT91C_ID_TWI);
|
*AT91C_PMC_PCER = (1 << AT91C_ID_TWI);
|
||||||
|
|
||||||
/* SDA & SCL from Peripheral A, Open Drain, no Pullup */
|
/* SDA & SCL from Peripheral A, Open Drain, no Pullup */
|
||||||
|
Loading…
Reference in New Issue
Block a user