File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,19 @@ The known limitations are:
6767So, if your C code has writable data, make sure the data is defined globally,
6868without an initialiser, and only written to within functions.
6969
70+ Linker limitation: the native module is not linked against the symbol table of the
71+ full MicroPython firmware. Rather, it is linked against an explicit table of exported
72+ symbols found in ``mp_fun_table `` (in ``py/nativeglue.h ``), that is fixed at firmware
73+ build time. It is thus not possible to simply call some arbitrary HAL/OS/RTOS/system
74+ function, for example.
75+
76+ New symbols can be added to the end of the table and the firmware rebuilt.
77+ The symbols also need to be added to ``tools/mpy_ld.py ``'s ``fun_table `` dict in the
78+ same location. This allows ``mpy_ld.py `` to be able to pick the new symbols up and
79+ provide relocations for them when the mpy is imported. Finally, if the symbol is a
80+ function, a macro or stub should be added to ``py/dynruntime.h `` to make it easy to
81+ call the function.
82+
7083Defining a native module
7184------------------------
7285
You can’t perform that action at this time.
0 commit comments