circuitpython/ports/powerpc
David Lechner c118b5d0e4 extmod/extmod.mk: Separate out extmod file list from py.mk to extmod.mk.
This separates extmod source files from `py.mk`.  Previously, `py.mk`
assumed that every consumer of the py/ directory also wanted to include
extmod/.  However, this is not the case.  For example, building mpy-cross
uses py/ but doesn't need extmod/.

This commit moves all extmod-specific items from `py.mk` to `extmod.mk` and
explicitly includes `extmod.mk` in ports that use it.

Signed-off-by: David Lechner <david@pybricks.com>
2022-06-21 00:14:34 +10:00
..
frozentest.mpy ports: Recompile bytecode tests now that .mpy format changed. 2022-04-14 23:52:14 +10:00
frozentest.py all: Reformat C and Python source code with tools/codeformat.py. 2020-02-28 10:33:03 +11:00
head.S powerpc: Add initial port to bare metal PowerPC arch. 2019-10-22 22:45:33 +11:00
main.c py/builtin: Clean up and simplify import_stat and builtin_open config. 2022-05-25 13:04:45 +10:00
Makefile extmod/extmod.mk: Separate out extmod file list from py.mk to extmod.mk. 2022-06-21 00:14:34 +10:00
mpconfigport.h ports: Remove def of MP_PLAT_PRINT_STRN if it's the same as the default. 2021-02-04 22:39:17 +11:00
mphalport.h all: Reformat C and Python source code with tools/codeformat.py. 2020-02-28 10:33:03 +11:00
powerpc.lds powerpc: Add initial port to bare metal PowerPC arch. 2019-10-22 22:45:33 +11:00
qstrdefsport.h all: Add *FORMAT-OFF* in various places. 2020-02-28 10:31:07 +11:00
README.md powerpc/uart: Choose which UART to use at build time, not runtime. 2020-05-29 22:54:55 +10:00
uart_lpc_serial.c powerpc/uart: Choose which UART to use at build time, not runtime. 2020-05-29 22:54:55 +10:00
uart_lpc_serial.h powerpc: Add initial port to bare metal PowerPC arch. 2019-10-22 22:45:33 +11:00
uart_potato.c powerpc/uart: Choose which UART to use at build time, not runtime. 2020-05-29 22:54:55 +10:00
uart_potato.h powerpc: Add initial port to bare metal PowerPC arch. 2019-10-22 22:45:33 +11:00
unistd.h powerpc: Add initial port to bare metal PowerPC arch. 2019-10-22 22:45:33 +11:00

The PowerPC port that runs on microwatt and qemu

This port is intended to be a minimal MicroPython port that runs in QEMU, microwatt simulator with ghdl or microwatt on Xilinx FPGA with potato UART.

Building

By default the port will be built with the potato uart for microwatt:

$ make

To instead build for a machine with LPC serial, such as QEMU powernv:

$ make UART=lpc_serial

Cross compilation for POWERPC

If you need to cross compilers you'll want to grab a powerpc64le compiler (not powerpc or powerpc64).

On Ubuntu (18.04) you'll want:

$ apt install gcc-powerpc64le-linux-gnu

(Use CROSS_COMPILE=powerpc64le-linux-gnu-)

If your distro doesn't have cross compilers, you can get cross compilers here:

(Avoid musl libc as it defines __assert_fail() differently to glibc which breaks the micropython powerpc code)

Then do:

$ make CROSS_COMPILE=<compiler prefix>

Building will produce the build/firmware.bin file which can be used QEMU or microwatt.

To run in QEMU use:

$ ./qemu-system-ppc64 -M powernv -cpu POWER9 -nographic -bios build/firmware.bin