mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-23 04:41:12 +00:00
Add debugging prints, enable backlight for stage1
This commit is contained in:
parent
33f76545df
commit
353019a269
2 changed files with 19 additions and 2 deletions
|
@ -12,11 +12,18 @@
|
||||||
#define BCT0_LOAD_END_ADDRESS (uintptr_t)(0x4003F000)
|
#define BCT0_LOAD_END_ADDRESS (uintptr_t)(0x4003F000)
|
||||||
#define MAGIC_BCT0 0x30544342
|
#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) {
|
const char *load_config(void) {
|
||||||
if (!read_sd_file((void *)BCT0_LOAD_ADDRESS, BCT0_LOAD_END_ADDRESS - BCT0_LOAD_ADDRESS, "BCT.ini")) {
|
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");
|
printk("Failed to read BCT0 from SD!\n");
|
||||||
generic_panic();
|
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) {
|
if ((*((u32 *)(BCT0_LOAD_ADDRESS))) != MAGIC_BCT0) {
|
||||||
printk("Error: Unexpected magic in BCT.ini!\n");
|
printk("Error: Unexpected magic in BCT.ini!\n");
|
||||||
generic_panic();
|
generic_panic();
|
||||||
|
@ -62,6 +69,10 @@ int main(void) {
|
||||||
lfb_base = display_init_framebuffer();
|
lfb_base = display_init_framebuffer();
|
||||||
video_init(lfb_base);
|
video_init(lfb_base);
|
||||||
|
|
||||||
|
/* Turn on the backlight after initializing the lfb */
|
||||||
|
/* to avoid flickering. */
|
||||||
|
display_enable_backlight(true);
|
||||||
|
|
||||||
/* Say hello. */
|
/* Say hello. */
|
||||||
printk("Welcome to Atmosph\xe8re Fus\xe9" "e!\n");
|
printk("Welcome to Atmosph\xe8re Fus\xe9" "e!\n");
|
||||||
printk("Using color linear framebuffer at 0x%p!\n", lfb_base);
|
printk("Using color linear framebuffer at 0x%p!\n", lfb_base);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include <stdint.h>
|
||||||
#include "sd_utils.h"
|
#include "sd_utils.h"
|
||||||
#include "stage2.h"
|
#include "stage2.h"
|
||||||
#include "lib/printk.h"
|
#include "lib/printk.h"
|
||||||
|
@ -44,6 +45,11 @@ stage2_entrypoint_t load_stage2(const char *bct0) {
|
||||||
generic_panic();
|
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)) {
|
if (!read_sd_file((void *)config.load_address, 0x100000, config.filename)) {
|
||||||
printk("Error: Failed to read stage2 (%s)!\n", config.filename);
|
printk("Error: Failed to read stage2 (%s)!\n", config.filename);
|
||||||
generic_panic();
|
generic_panic();
|
||||||
|
|
Loading…
Reference in a new issue