diff --git a/fusee/fusee-primary/src/main.c b/fusee/fusee-primary/src/main.c index 8bfd4bbe2..6acfffa6f 100644 --- a/fusee/fusee-primary/src/main.c +++ b/fusee/fusee-primary/src/main.c @@ -12,11 +12,18 @@ #define BCT0_LOAD_END_ADDRESS (uintptr_t)(0x4003F000) #define MAGIC_BCT0 0x30544342 +#define DEFAULT_BCT0_FOR_DEBUG "BCT0\n[stage1]\nstage2_file = stage2.bin\nstage2_addr = 0xFFF00000\nstage2_entrypoint = 0xCAFEBABE\n" + const char *load_config(void) { if (!read_sd_file((void *)BCT0_LOAD_ADDRESS, BCT0_LOAD_END_ADDRESS - BCT0_LOAD_ADDRESS, "BCT.ini")) { - printk("Error: Failed to load BCT.ini!\n"); - generic_panic(); + printk("Failed to read BCT0 from SD!\n"); + printk("[DEBUG] Using default BCT0!\n"); + memcpy((void *)BCT0_LOAD_ADDRESS, DEFAULT_BCT0_FOR_DEBUG, sizeof(DEFAULT_BCT0_FOR_DEBUG)); + /* TODO: Stop using default. */ + /* printk("Error: Failed to load BCT.ini!\n"); + * generic_panic(); */ } + if ((*((u32 *)(BCT0_LOAD_ADDRESS))) != MAGIC_BCT0) { printk("Error: Unexpected magic in BCT.ini!\n"); generic_panic(); @@ -62,6 +69,10 @@ int main(void) { lfb_base = display_init_framebuffer(); video_init(lfb_base); + /* Turn on the backlight after initializing the lfb */ + /* to avoid flickering. */ + display_enable_backlight(true); + /* Say hello. */ printk("Welcome to Atmosph\xe8re Fus\xe9" "e!\n"); printk("Using color linear framebuffer at 0x%p!\n", lfb_base); diff --git a/fusee/fusee-primary/src/stage2.c b/fusee/fusee-primary/src/stage2.c index fd6e710ab..0eaa4b549 100644 --- a/fusee/fusee-primary/src/stage2.c +++ b/fusee/fusee-primary/src/stage2.c @@ -1,4 +1,5 @@ #include "utils.h" +#include #include "sd_utils.h" #include "stage2.h" #include "lib/printk.h" @@ -44,6 +45,11 @@ stage2_entrypoint_t load_stage2(const char *bct0) { generic_panic(); } + printk("[DEBUG] Stage 2 Config:\n"); + printk(" Filename: %s\n", config.filename); + printk(" Load Address: 0x%08x\n", config.load_address); + printk(" Entrypoint: 0x%p\n", config.entrypoint); + if (!read_sd_file((void *)config.load_address, 0x100000, config.filename)) { printk("Error: Failed to read stage2 (%s)!\n", config.filename); generic_panic();