pe: split fx-CG 50 and fx-9860G III versions

Both working although with terrible UI.
This commit is contained in:
Lephenixnoir 2022-10-29 20:42:43 +02:00
parent e1df7e5f0b
commit ce4fefebbe
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
12 changed files with 65 additions and 26 deletions

1
ports/fx9860g3/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/PythonExtra.g1a

14
ports/fx9860g3/Makefile Normal file
View File

@ -0,0 +1,14 @@
include ../../py/mkenv.mk
SH_CFLAGS := -DFX9860G
SH_LDFLAGS := -T fx9860g.ld -lm -lgint-fx -lc -lgint-fx -lgcc
all: PythonExtra.g1a
PythonExtra.g1a: $(BUILD)/firmware.bin icon.png
fxgxa --g1a -n PythonExtra -i icon.png $< -o $@
send: all
fxlink -sw PythonExtra.g1a
include $(TOP)/ports/sh/Makefile

BIN
ports/fx9860g3/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1 @@
../sh/mpconfigport.h

14
ports/fxcg50/Makefile Normal file
View File

@ -0,0 +1,14 @@
include ../../py/mkenv.mk
SH_CFLAGS := -DFXCG50
SH_LDFLAGS := -T fxcg50.ld -lm -lgint-cg -lc -lgint-cg -lgcc
all: PythonExtra.g3a
PythonExtra.g3a: $(BUILD)/firmware.bin icon-uns.png icon-sel.png
fxgxa --g3a -n PythonExtra --icon-uns=icon-uns.png --icon-sel=icon-sel.png $< -o $@
send: all
fxlink -sw PythonExtra.g3a
include $(TOP)/ports/sh/Makefile

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

1
ports/fxcg50/mpconfigport.h Symbolic link
View File

@ -0,0 +1 @@
../sh/mpconfigport.h

View File

@ -1,21 +1,20 @@
include ../../py/mkenv.mk
# Use the sh-elf toolchain
CROSS_COMPILE := sh-elf-
include $(TOP)/py/py.mk
include $(TOP)/extmod/extmod.mk
CFLAGS += -m4-nofpu -mb -fstrict-volatile-bitfields -I. -I$(BUILD) -I$(TOP) -DFXCG50 -O2 -Wall -Wextra -Wno-unused-parameter
LIBS += -nostdlib -Wl,--no-warn-rwx-segments -T fxcg50.ld -lm -lgint-cg -lc -lgint-cg -lgcc -Wl,-Map=build/map
CFLAGS += -m4-nofpu -mb -fstrict-volatile-bitfields \
-I. -I$(TOP)/ports/sh -I$(BUILD) -I$(TOP) \
$(SH_CFLAGS) -Os -Wall -Wextra -Wno-unused-parameter
LIBS += -nostdlib -Wl,--no-warn-rwx-segments $(SH_LDFLAGS) -Wl,-Map=build/map
# Source files
SRC_C = \
main.c \
console.c \
keymap.c \
modgint.c \
mphalport.c \
ports/sh/main.c \
ports/sh/console.c \
ports/sh/keymap.c \
ports/sh/modgint.c \
ports/sh/mphalport.c \
shared/readline/readline.c \
shared/runtime/gchelper_generic.c \
shared/runtime/pyexec.c \
@ -23,15 +22,10 @@ SRC_C = \
SRC_QSTR += \
shared/readline/readline.c \
modgint.c \
ports/sh/modgint.c \
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
all: $(BUILD)/firmware.elf PythonExtra.g3a
PythonExtra.g3a: $(BUILD)/firmware.bin icon-uns.png icon-sel.png
fxgxa --g3a -n PythonExtra --icon-uns=icon-uns.png --icon-sel=icon-sel.png $< -o $@
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf
$(Q)$(CC:gcc=objcopy) -O binary -R .bss -R .gint_bss $< $@
@ -40,7 +34,4 @@ $(BUILD)/firmware.elf: $(OBJ)
$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
$(Q)$(SIZE) $@
send: all
fxlink -sw PythonExtra.g3a
include $(TOP)/py/mkrules.mk

View File

@ -8,7 +8,11 @@
#define PE_CONSOLE_LINE_MAX_LENGTH 1024
/* Line spacing in the console */
#define PE_CONSOLE_LINE_SPACING 13
#ifdef FX9860G
# define PE_CONSOLE_LINE_SPACING 8
#else
# define PE_CONSOLE_LINE_SPACING 13
#endif
//=== Dynamic console lines ===//

View File

@ -15,11 +15,6 @@
#include <stdlib.h>
#include "console.h"
// Allocate memory for the MicroPython GC heap.
static char heap[32768];
int parse_compile_execute(const void *source, mp_parse_input_kind_t input_kind, mp_uint_t exec_flags);
//=== Console-based standard streams ===//
ssize_t stdouterr_write(void *data, void const *buf, size_t size)
@ -43,19 +38,28 @@ static console_t *cons = NULL;
void pe_draw(void)
{
dclear(C_WHITE);
#ifdef FX9860G
int rows = 8;
console_render(1, 1, cons, DWIDTH-2, rows);
#else
dprint(3, 3, C_BLACK, "PythonExtra, very much WIP :)");
dline(2, 16, DWIDTH-3, 16, C_BLACK);
int rows = 12;
console_render(3, 20, cons, DWIDTH-6, rows);
int y = 20 + PE_CONSOLE_LINE_SPACING * rows;
dline(2, y, DWIDTH-3, y, C_BLACK);
#endif
dupdate();
}
void pe_exithandler(void)
{
pe_draw();
#ifdef FX9860G
drect(DWIDTH-4, 0, DWIDTH-1, 3, C_BLACK);
#else
drect(DWIDTH-8, 0, DWIDTH-1, 7, C_RED);
#endif
dupdate();
getkey();
}
@ -72,8 +76,17 @@ int main(int argc, char **argv)
atexit(pe_exithandler);
/* Initialize MicroPython */
#define HEAP_SIZE 32768
void *heap = malloc(32768);
if(!heap) {
dclear(C_WHITE);
dtext(1, 1, C_BLACK, "No heap!");
getkey();
return 1;
}
mp_stack_ctrl_init();
gc_init(heap, heap + sizeof(heap));
gc_init(heap, heap + HEAP_SIZE);
// TODO: gc_add(start, end) for each area we want to allocate to
// fx-9860G III:
// * (nothing? x_x)