Change defaut BCT0 for debug

This commit is contained in:
TuxSH 2018-05-04 21:52:38 +02:00
parent 4199be2460
commit dc3099781d

View file

@ -13,7 +13,12 @@
#define BCT0_LOAD_END_ADDRESS (uintptr_t)(0x4003F000)
#define MAGIC_BCT0 0x30544342
#define DEFAULT_BCT0_FOR_DEBUG "BCT0\n[stage1]\nstage2_path = stage2.bin\nstage2_addr = 0xFFF00000\nstage2_entrypoint = 0xCAFEBABE\n"
#define DEFAULT_BCT0_FOR_DEBUG \
"BCT0\n"\
"[stage1]\n"\
"stage2_path = fusee-secondary.bin\n"\
"stage2_addr = 0xFFF00000\n"\
"stage2_entrypoint = 0xFFF00000\n"
const char *load_config(void) {
if (!read_sd_file((void *)BCT0_LOAD_ADDRESS, BCT0_LOAD_END_ADDRESS - BCT0_LOAD_ADDRESS, "BCT.ini")) {
@ -24,7 +29,7 @@ const char *load_config(void) {
/* 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();
@ -60,42 +65,42 @@ int main(void) {
u32 *lfb_base;
char buf[0x400];
memset(buf, 0xCC, 0x400);
/* Initialize DRAM. */
/* TODO: What can be stripped out to make this minimal? */
nx_hwinit();
/* Initialize the display. */
display_init();
/* Register the display as a printk provider. */
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);
/* Try to load the SBK into the security engine, if possible. */
/* TODO: Should this be done later? */
load_sbk();
/* Load the BCT0 configuration ini off of the SD. */
bct0 = load_config();
/* Load the loader payload into DRAM. */
stage2_entrypoint = load_stage2(bct0);
/* Setup argv. */
memset(stage2_argv, 0, STAGE2_ARGC * sizeof(*stage2_argv));
stage2_argv[STAGE2_ARGV_PROGRAM_PATH] = (void *)stage2_get_program_path();
stage2_argv[STAGE2_ARGV_ARGUMENT_STRUCT] = &stage2_argv[STAGE2_ARGC];
stage2_args_t *args = (stage2_args_t *)stage2_argv[STAGE2_ARGV_ARGUMENT_STRUCT];
/* Setup arguments struct. */
args->version = 0;
args->bct0 = bct0;
@ -103,8 +108,8 @@ int main(void) {
args->console_col = video_get_col();
args->console_row = video_get_row();
save_sd_state(&args->sd_mmc, &args->sd_fs);
/* Jump to Stage 2. */
stage2_entrypoint(STAGE2_ARGC, stage2_argv);
return 0;