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 !206
parents 05b94cac e04c9269
No related branches found
No related tags found
1 merge request!206make .elf execution build-time configurable
Pipeline #3073 passed
.. _how_to_build:
How To Build
============
If you just want to write MicroPython code for card10, you probably **won't**
......@@ -102,6 +104,7 @@ firmware features:
info related to BLE.
- ``-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.
- ``-Djailbreak_card10=true``: Enable execution of .elf l0dables on core 1.
.. warning::
......
......@@ -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
linker script and should link against the api-caller library so they can
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::
......
......@@ -70,6 +70,14 @@ subdir('ble/')
subdir('l0der/')
epicardium_cargs = []
if get_option('jailbreak_card10')
epicardium_cargs += [
'-DJAILBREAK_CARD10=1',
]
endif
elf = executable(
name + '.elf',
'cdcacm.c',
......@@ -88,6 +96,7 @@ elf = executable(
'-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
'-Wl,--defsym=_write=_write_epicardium',
],
c_args: epicardium_cargs,
)
epicardium_bin = custom_target(
......
......@@ -88,7 +88,9 @@ static int load_stat(char *name)
*/
static int do_load(struct load_info *info)
{
#if defined(JAILBREAK_CARD10) && (JAILBREAK_CARD10 == 1)
struct l0dable_info l0dable;
#endif
int res;
if (*info->name == '\0') {
......@@ -127,6 +129,7 @@ static int do_load(struct load_info *info)
case PL_PYTHON_INTERP:
core1_load(PYCARDIUM_IVT, info->name);
break;
#if defined(JAILBREAK_CARD10) && (JAILBREAK_CARD10 == 1)
case PL_L0DABLE:
res = l0der_load_path(info->name, &l0dable);
if (res != 0) {
......@@ -137,6 +140,7 @@ static int do_load(struct load_info *info)
core1_load(l0dable.isr_vector, "");
break;
#endif
default:
LOG_ERR("lifecyle",
"Attempted to load invalid payload (%s)",
......
......@@ -21,3 +21,11 @@ option(
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.
Finish editing this message first!
Please register or to comment