mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-04-11 16:37:45 -04:00
echoplayer: allow enabling system debug in normal builds
Allow toggling the system debug state from the debug menu in Rockbox, or by holding a button combo at boot, so that an SWD/JTAG debugger can be attached to normal non-debug builds without too much hassle. Change-Id: Iee47ef916ade2e5ec1094a63c68e48f1b27b0bbb
This commit is contained in:
parent
02648abb8a
commit
19af7131e2
4 changed files with 131 additions and 1 deletions
|
|
@ -34,6 +34,7 @@
|
|||
#include "rbversion.h"
|
||||
#include "system-echoplayer.h"
|
||||
#include "gpio-stm32h7.h"
|
||||
#include "regs/cortex-m/cm_debug.h"
|
||||
|
||||
#define SDRAM_SIZE (MEMORYSIZE * 1024 * 1024)
|
||||
|
||||
|
|
@ -136,6 +137,14 @@ static bool is_usbmode_button_pressed(void)
|
|||
return button_status() & BUTTON_DOWN;
|
||||
}
|
||||
|
||||
static bool is_sysdebug_button_pressed(void)
|
||||
{
|
||||
const int mask = BUTTON_A | BUTTON_B;
|
||||
|
||||
/* Both buttons must be held */
|
||||
return (button_status() & mask) == mask;
|
||||
}
|
||||
|
||||
static int send_event_on_tmo(struct timeout *tmo)
|
||||
{
|
||||
button_queue_post(tmo->data, 0);
|
||||
|
|
@ -370,6 +379,13 @@ void main(void)
|
|||
power_init();
|
||||
button_init();
|
||||
|
||||
/* Enable system debugging if button combo held or debugger attached */
|
||||
if (reg_readf(CM_DEBUG_DHCSR, C_DEBUGEN) ||
|
||||
is_sysdebug_button_pressed())
|
||||
{
|
||||
system_debug_enable(true);
|
||||
}
|
||||
|
||||
/* Start monitoring power button / usb state */
|
||||
monitor_init();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue