diff --git a/litex/soc/software/bios/boot.c b/litex/soc/software/bios/boot.c index 1419a8e03..7a8198b2c 100644 --- a/litex/soc/software/bios/boot.c +++ b/litex/soc/software/bios/boot.c @@ -156,7 +156,7 @@ int serialboot(void) printf("Booting from serial...\n"); printf("Press Q or ESC to abort boot completely.\n"); - /* send the serialboot "magic" request to Host */ + /* Send the serialboot "magic" request to Host */ c = str; while(*c) { uart_write(*c); @@ -171,7 +171,7 @@ int serialboot(void) printf("Cancelled\n"); return 0; } - /* assume ACK_OK */ + /* Assume ACK_OK */ failed = 0; while(1) { @@ -239,7 +239,7 @@ int serialboot(void) addr = get_uint32(&frame.payload[0]); for (i = 4; i < frame.payload_length; i++) { - // erase page at sector boundaries before writing + /* Erase page at sector boundaries before writing */ if ((addr & (SPIFLASH_SECTOR_SIZE - 1)) == 0) { erase_flash_sector(addr); } @@ -314,10 +314,17 @@ static void netboot_from_json(const char * filename, unsigned int ip, unsigned s uint8_t count; /* FIXME: modify/increase if too limiting */ - char json_buffer[256]; - char image_filename[32]; - char image_address[32]; - uint8_t image_found; + char json_buffer[1024]; + char json_name[32]; + char json_value[32]; + + unsigned long boot_r1 = 0; + unsigned long boot_r2 = 0; + unsigned long boot_r3 = 0; + unsigned long boot_addr = 0; + + uint8_t image_found = 0; + uint8_t boot_addr_found = 0; /* Read JSON file */ size = tftp_get(ip, tftp_port, filename, json_buffer); @@ -325,31 +332,55 @@ static void netboot_from_json(const char * filename, unsigned int ip, unsigned s return; /* Parse JSON file */ - jsmntok_t t[16]; + jsmntok_t t[32]; jsmn_parser p; jsmn_init(&p); - image_found = 0; count = jsmn_parse(&p, json_buffer, strlen(json_buffer), t, sizeof(t)/sizeof(*t)); for (i=0; i