Skip to content

Commit

Permalink
Merge pull request #6 from aczid/esp32
Browse files Browse the repository at this point in the history
Added support for compiling micropython on Linux with SDL-backed ugfx
  • Loading branch information
annejan authored Jun 10, 2017
2 parents 5b4f520 + 99c1395 commit b506506
Show file tree
Hide file tree
Showing 6 changed files with 430 additions and 4 deletions.
11 changes: 7 additions & 4 deletions esp32/modugfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
#include <stdbool.h>
#include <stdio.h>

#ifndef UNIX
#include "board_framebuffer.h"
#endif

#include "gfx.h"
#include "gfxconf.h"

Expand Down Expand Up @@ -381,8 +384,8 @@ STATIC mp_obj_t ugfx_polygon(mp_uint_t n_args, const mp_obj_t *args) {

mp_obj_t *mp_arr;
mp_obj_t *mp_arr2;
uint len;
uint len2;
size_t len;
size_t len2;
mp_obj_get_array(args[2], &len, &mp_arr);

if (len <= 20) {
Expand Down Expand Up @@ -419,8 +422,8 @@ STATIC mp_obj_t ugfx_fill_polygon(mp_uint_t n_args, const mp_obj_t *args) {

mp_obj_t *mp_arr;
mp_obj_t *mp_arr2;
uint len;
uint len2;
size_t len;
size_t len2;
mp_obj_get_array(args[2], &len, &mp_arr);

if (len <= 20) {
Expand Down
23 changes: 23 additions & 0 deletions unix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ include ../py/py.mk
INC += -I.
INC += -I..
INC += -I$(BUILD)
INC += -I../../components/ugfx
INC += -I../../ugfx/src/gdisp/mcufont
INC += -I../../ugfx
INC += -I../esp32
INC += -I../../ugfx/src
INC += -I../../ugfx/drivers/multiple/SDL/

# compiler settings
CWARN = -Wall -Werror
Expand Down Expand Up @@ -142,6 +148,9 @@ SRC_C = \
input.c \
file.c \
modmachine.c \
../esp32/modugfx.c \
../../ugfx/drivers/multiple/SDL/gdisp_lld_SDL.c \
gfx_mk.c \
modos.c \
moduos_vfs.c \
modtime.c \
Expand All @@ -151,6 +160,20 @@ SRC_C = \
fatfs_port.c \
$(SRC_MOD)

OPT_GFXDRIVER = SDL
OPT_OS = linux
OPT_LINK_OPTIMIZE = yes
OPT_CPU = x64
GFXLIB = ../../ugfx/

include $(GFXLIB)/boards/base/Linux-SDL/board.mk
include $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk
include $(GFXLIB)/tools/gmake_scripts/os_$(OPT_OS).mk

# expand all the uGFX definitions from DEFS into CPP defines
SRCFLAGS += -I. $(patsubst %,-I%,$(INCPATH)) $(patsubst %,-D%,$(patsubst -D%,%,$(DEFS)))
CFLAGS += $(SRCFLAGS)

LIB_SRC_C = $(addprefix lib/,\
$(LIB_SRC_C_EXTRA) \
timeutils/timeutils.c \
Expand Down
17 changes: 17 additions & 0 deletions unix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
get all the submodules for micropython if you haven't already

cd micropython

git submodule update --init --recursive

Satisfy axtls generating its version.h

cd lib/axtls
make menuconfig

Build axtls and the binary

cd unix
make axtls
make

21 changes: 21 additions & 0 deletions unix/gfx_mk.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* This file is subject to the terms of the GFX License. If a copy of
* the license was not distributed with this file, you can obtain one at:
*
* http://ugfx.org/license.html
*/

#include "gfx.c"
#include "gos/gos_mk.c"
#include "gdriver/gdriver_mk.c"
#include "gqueue/gqueue_mk.c"
#include "gdisp/gdisp_mk.c"
#include "gevent/gevent_mk.c"
#include "gtimer/gtimer_mk.c"
#include "gwin/gwin_mk.c"
#include "ginput/ginput_mk.c"
#include "gadc/gadc_mk.c"
#include "gaudio/gaudio_mk.c"
#include "gmisc/gmisc_mk.c"
#include "gfile/gfile_mk.c"
#include "gtrans/gtrans_mk.c"
Loading

0 comments on commit b506506

Please sign in to comment.