mirror of
https://github.com/CTCaer/hekate.git
synced 2024-12-22 16:12:03 +00:00
exo: Support uart logging
This can be enabled via compile time flags or exosphere.ini. Compile time flags override exosphere.ini
This commit is contained in:
parent
ad560b650e
commit
b6ec217484
5 changed files with 35 additions and 11 deletions
7
Makefile
7
Makefile
|
@ -67,11 +67,12 @@ CUSTOMDEFINES += -DBL_VER_MJ=$(BLVERSION_MAJOR) -DBL_VER_MN=$(BLVERSION_MINOR) -
|
|||
CUSTOMDEFINES += -DNYX_VER_MJ=$(NYXVERSION_MAJOR) -DNYX_VER_MN=$(NYXVERSION_MINOR) -DNYX_VER_HF=$(NYXVERSION_HOTFX) -DNYX_RESERVED=$(NYXVERSION_RSVD)
|
||||
CUSTOMDEFINES += -DGFX_INC=$(GFX_INC) -DFFCFG_INC=$(FFCFG_INC)
|
||||
|
||||
# 0: UART_A, 1: UART_B.
|
||||
#CUSTOMDEFINES += -DDEBUG_UART_PORT=0
|
||||
|
||||
#CUSTOMDEFINES += -DDEBUG
|
||||
|
||||
# UART Logging: Max baudrate 12.5M.
|
||||
# DEBUG_UART_PORT - 0: UART_A, 1: UART_B, 2: UART_C.
|
||||
#CUSTOMDEFINES += -DDEBUG_UART_BAUDRATE=115200 -DDEBUG_UART_INVERT=0 -DDEBUG_UART_PORT=0
|
||||
|
||||
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
|
||||
CFLAGS = $(ARCH) -O2 -g -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall $(CUSTOMDEFINES)
|
||||
LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections -Xlinker --defsym=IPL_LOAD_ADDR=$(IPL_LOAD_ADDR)
|
||||
|
|
|
@ -377,7 +377,8 @@ void hw_init()
|
|||
|
||||
#ifdef DEBUG_UART_PORT
|
||||
clock_enable_uart(DEBUG_UART_PORT);
|
||||
uart_init(DEBUG_UART_PORT, 115200);
|
||||
uart_init(DEBUG_UART_PORT, DEBUG_UART_BAUDRATE);
|
||||
uart_invert(DEBUG_UART_PORT, DEBUG_UART_INVERT, UART_INVERT_TXD);
|
||||
#endif
|
||||
|
||||
// Enable Dynamic Voltage and Frequency Scaling device clock.
|
||||
|
|
|
@ -82,8 +82,10 @@ typedef struct _exo_cfg_t
|
|||
u32 fwno;
|
||||
u32 flags[2];
|
||||
u16 display_id;
|
||||
u16 rsvd0;
|
||||
u32 rsvd1[3];
|
||||
u8 uart_port;
|
||||
u8 uart_invert;
|
||||
u32 uart_baudrate;
|
||||
u32 rsvd1[2];
|
||||
exo_emummc_config_t emummc_cfg;
|
||||
} exo_cfg_t;
|
||||
|
||||
|
@ -244,6 +246,12 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base, bool exo_new)
|
|||
{
|
||||
if (!strcmp("debugmode_user", kv->key))
|
||||
user_debug = atoi(kv->val);
|
||||
else if (!strcmp("log_port", kv->key))
|
||||
exo_cfg->uart_port = atoi(kv->val);
|
||||
else if (!strcmp("log_inverted", kv->key))
|
||||
exo_cfg->uart_invert = atoi(kv->val);
|
||||
else if (!strcmp("log_baud_rate", kv->key))
|
||||
exo_cfg->uart_baudrate = atoi(kv->val);
|
||||
else if (emu_cfg.enabled && !h_cfg.emummc_force_disable)
|
||||
{
|
||||
if (!strcmp("blank_prodinfo_emummc", kv->key))
|
||||
|
@ -345,6 +353,16 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base, bool exo_new)
|
|||
// Set display id.
|
||||
exo_cfg->display_id = display_get_decoded_panel_id();
|
||||
}
|
||||
|
||||
#ifdef DEBUG_UART_PORT
|
||||
// Ovverride logging parameters if set in compile time.
|
||||
if (!ctxt->stock)
|
||||
{
|
||||
exo_cfg->uart_port = DEBUG_UART_PORT;
|
||||
exo_cfg->uart_invert = DEBUG_UART_INVERT;
|
||||
exo_cfg->uart_baudrate = DEBUG_UART_BAUDRATE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static const char *get_error_desc(u32 error_desc)
|
||||
|
|
11
nyx/Makefile
11
nyx/Makefile
|
@ -80,12 +80,15 @@ CUSTOMDEFINES := -DNYX_LOAD_ADDR=$(NYX_LOAD_ADDR) -DNYX_MAGIC=$(NYX_MAGIC)
|
|||
CUSTOMDEFINES += -DNYX_VER_MJ=$(NYXVERSION_MAJOR) -DNYX_VER_MN=$(NYXVERSION_MINOR) -DNYX_VER_HF=$(NYXVERSION_HOTFX) -DNYX_RESERVED=$(NYXVERSION_RSVD)
|
||||
CUSTOMDEFINES += -DNYX -DGFX_INC=$(GFX_INC) -DFFCFG_INC=$(FFCFG_INC)
|
||||
|
||||
# 0: UART_A, 1: UART_B, 2: UART_C.
|
||||
# Also enables LV LOG.
|
||||
#CUSTOMDEFINES += -DDEBUG_UART_PORT=1
|
||||
|
||||
#CUSTOMDEFINES += -DDEBUG
|
||||
|
||||
# UART Logging: Max baudrate 12.5M. Disables Joycon on Nyx if UARTB or UARTC.
|
||||
# DEBUG_UART_PORT - 0: UART_A, 1: UART_B, 2: UART_C.
|
||||
#CUSTOMDEFINES += -DDEBUG_UART_BAUDRATE=115200 -DDEBUG_UART_INVERT=0 -DDEBUG_UART_PORT=0
|
||||
|
||||
# LvGL UART LOG.
|
||||
#CUSTOMDEFINES += -DDEBUG_UART_LV_LOG
|
||||
|
||||
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb-interwork
|
||||
CFLAGS = $(ARCH) -O2 -g -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -std=gnu11 -Wall $(CUSTOMDEFINES)
|
||||
LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections -Xlinker --defsym=NYX_LOAD_ADDR=$(NYX_LOAD_ADDR)
|
||||
|
|
|
@ -436,7 +436,8 @@ void ipl_main()
|
|||
#endif
|
||||
pinmux_config_uart(DEBUG_UART_PORT);
|
||||
clock_enable_uart(DEBUG_UART_PORT);
|
||||
uart_init(DEBUG_UART_PORT, 115200);
|
||||
uart_init(DEBUG_UART_PORT, DEBUG_UART_BAUDRATE);
|
||||
uart_invert(DEBUG_UART_PORT, DEBUG_UART_INVERT, UART_INVERT_TXD);
|
||||
|
||||
uart_send(DEBUG_UART_PORT, (u8 *)"hekate-NYX: Hello!\r\n", 20);
|
||||
uart_wait_idle(DEBUG_UART_PORT, UART_TX_IDLE);
|
||||
|
|
Loading…
Reference in a new issue