Skip to content
Snippets Groups Projects
Commit 03d02219 authored by schneider's avatar schneider
Browse files

Merge branch 'jailbreak' into 'master'

make .elf execution build-time configurable

See merge request card10/firmware!206
parents 05b94cac e04c9269
No related branches found
No related tags found
No related merge requests found
.. _how_to_build:
How To Build How To Build
============ ============
If you just want to write MicroPython code for card10, you probably **won't** If you just want to write MicroPython code for card10, you probably **won't**
...@@ -102,6 +104,7 @@ firmware features: ...@@ -102,6 +104,7 @@ firmware features:
info related to BLE. info related to BLE.
- ``-Ddebug_core1=true``: Enable the core 1 SWD lines which are exposed on the - ``-Ddebug_core1=true``: Enable the core 1 SWD lines which are exposed on the
SAO connector. Only use this if you have a debugger which is modified for core 1. SAO connector. Only use this if you have a debugger which is modified for core 1.
- ``-Djailbreak_card10=true``: Enable execution of .elf l0dables on core 1.
.. warning:: .. warning::
......
...@@ -51,6 +51,9 @@ Next to Pycardium, other bare-metal code can also run on core 1. For example, ...@@ -51,6 +51,9 @@ Next to Pycardium, other bare-metal code can also run on core 1. For example,
a Rustcardium or C-cardium. These l0dables must be compiled using our special a Rustcardium or C-cardium. These l0dables must be compiled using our special
linker script and should link against the api-caller library so they can linker script and should link against the api-caller library so they can
interface with the :ref:`epicardium_api`. interface with the :ref:`epicardium_api`.
Note: this feature is disabled by default and has to be enabled at build time.
To do this, run ``bootstrap.sh`` with the option ``-Djailbreak_card10=true``
and rebuild the firmware as described in :ref:`how_to_build`.
.. todo:: .. todo::
......
...@@ -70,6 +70,14 @@ subdir('ble/') ...@@ -70,6 +70,14 @@ subdir('ble/')
subdir('l0der/') subdir('l0der/')
epicardium_cargs = []
if get_option('jailbreak_card10')
epicardium_cargs += [
'-DJAILBREAK_CARD10=1',
]
endif
elf = executable( elf = executable(
name + '.elf', name + '.elf',
'cdcacm.c', 'cdcacm.c',
...@@ -88,6 +96,7 @@ elf = executable( ...@@ -88,6 +96,7 @@ elf = executable(
'-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map', '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
'-Wl,--defsym=_write=_write_epicardium', '-Wl,--defsym=_write=_write_epicardium',
], ],
c_args: epicardium_cargs,
) )
epicardium_bin = custom_target( epicardium_bin = custom_target(
......
...@@ -88,7 +88,9 @@ static int load_stat(char *name) ...@@ -88,7 +88,9 @@ static int load_stat(char *name)
*/ */
static int do_load(struct load_info *info) static int do_load(struct load_info *info)
{ {
#if defined(JAILBREAK_CARD10) && (JAILBREAK_CARD10 == 1)
struct l0dable_info l0dable; struct l0dable_info l0dable;
#endif
int res; int res;
if (*info->name == '\0') { if (*info->name == '\0') {
...@@ -127,6 +129,7 @@ static int do_load(struct load_info *info) ...@@ -127,6 +129,7 @@ static int do_load(struct load_info *info)
case PL_PYTHON_INTERP: case PL_PYTHON_INTERP:
core1_load(PYCARDIUM_IVT, info->name); core1_load(PYCARDIUM_IVT, info->name);
break; break;
#if defined(JAILBREAK_CARD10) && (JAILBREAK_CARD10 == 1)
case PL_L0DABLE: case PL_L0DABLE:
res = l0der_load_path(info->name, &l0dable); res = l0der_load_path(info->name, &l0dable);
if (res != 0) { if (res != 0) {
...@@ -137,6 +140,7 @@ static int do_load(struct load_info *info) ...@@ -137,6 +140,7 @@ static int do_load(struct load_info *info)
core1_load(l0dable.isr_vector, ""); core1_load(l0dable.isr_vector, "");
break; break;
#endif
default: default:
LOG_ERR("lifecyle", LOG_ERR("lifecyle",
"Attempted to load invalid payload (%s)", "Attempted to load invalid payload (%s)",
......
...@@ -21,3 +21,11 @@ option( ...@@ -21,3 +21,11 @@ option(
description: 'Whether to enable WSF TRACE prints', description: 'Whether to enable WSF TRACE prints',
) )
option(
'jailbreak_card10',
type: 'boolean',
value: false,
description: 'Enable execution of .elf l0dables',
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment