mirror of
https://github.com/pine64/blisp.git
synced 2024-12-23 06:50:13 +00:00
Handle missing eflash loader in a nicer form
Print error rather than crashing
This commit is contained in:
parent
f60cfc02f9
commit
20c4fa0163
@ -252,11 +252,23 @@ void blisp_flash_firmware() {
|
|||||||
char exe_path[PATH_MAX];
|
char exe_path[PATH_MAX];
|
||||||
char eflash_loader_path[PATH_MAX];
|
char eflash_loader_path[PATH_MAX];
|
||||||
get_binary_folder(exe_path, PATH_MAX); // TODO: Error handling
|
get_binary_folder(exe_path, PATH_MAX); // TODO: Error handling
|
||||||
snprintf(eflash_loader_path, PATH_MAX, "%s/data/%s/eflash_loader_%s.bin", exe_path, device.chip->type_str, device.chip->default_eflash_loader_xtal);
|
snprintf(eflash_loader_path, PATH_MAX, "%s/data/%s/eflash_loader_%s.bin",
|
||||||
|
exe_path, device.chip->type_str,
|
||||||
eflash_loader_file = fopen(eflash_loader_path, "rb"); // TODO: Error handling
|
device.chip->default_eflash_loader_xtal);
|
||||||
uint8_t eflash_loader_header[176]; // TODO: Remap it to the boot header struct
|
printf("Loading the eflash loader file from disk\n");
|
||||||
fread(eflash_loader_header, 176, 1, eflash_loader_file); // TODO: Error handling
|
eflash_loader_file
|
||||||
|
= fopen(eflash_loader_path, "rb"); // TODO: Error handling
|
||||||
|
if (eflash_loader_file == NULL) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Could not open the eflash loader file from disk.\n"
|
||||||
|
"Does \"%s\" exist?\n",
|
||||||
|
eflash_loader_path);
|
||||||
|
goto exit1;
|
||||||
|
}
|
||||||
|
uint8_t
|
||||||
|
eflash_loader_header[176]; // TODO: Remap it to the boot header struct
|
||||||
|
fread(eflash_loader_header, 176, 1,
|
||||||
|
eflash_loader_file); // TODO: Error handling
|
||||||
|
|
||||||
printf("Loading eflash_loader...\n");
|
printf("Loading eflash_loader...\n");
|
||||||
ret = blisp_device_load_boot_header(&device, eflash_loader_header);
|
ret = blisp_device_load_boot_header(&device, eflash_loader_header);
|
||||||
|
Loading…
Reference in New Issue
Block a user