Merge branch 'master' into dev

This commit is contained in:
Amir Gonnen 2020-06-28 01:30:28 +03:00
commit efe39abd64
9 changed files with 112 additions and 7 deletions

View File

@ -459,6 +459,19 @@ DRIVERS_SRC_C += drivers/cyw43/cywbt.c
endif
endif
ifeq ($(MICROPY_PY_LVGL),1)
CFLAGS += -DMICROPY_PY_LVGL
SRC_LIB += $(shell find $(LVGL_BINDING_DIR)/driver/stm32/$(BOARD)/*.c)
SRC_LIB += $(shell find $(LVGL_BINDING_DIR)/driver/stm32/string1.c)
ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f7))
SRC_HAL += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\
hal_ltdc.c \
hal_ltdc_ex.c \
hal_dma2d.c \
)
endif
endif
OBJ =
OBJ += $(PY_O)
OBJ += $(addprefix $(BUILD)/, $(SRC_LIB:.c=.o))

View File

@ -9,3 +9,4 @@ TEXT1_ADDR = 0x08020000
MICROPY_PY_LWIP = 1
MICROPY_PY_USSL = 1
MICROPY_SSL_MBEDTLS = 1
MICROPY_PY_LVGL = 1

View File

@ -1,4 +1,4 @@
freeze('$(MPY_DIR)/drivers/dht', 'dht.py')
freeze('$(MPY_DIR)/drivers/display', ('lcd160cr.py', 'lcd160cr_test.py'))
freeze('$(MPY_DIR)/drivers/onewire', 'onewire.py')
freeze('$(MPY_DIR)/ports/stm32/modules', 'lvstm32.py')
freeze("$(MPY_DIR)/lib/lv_bindings/driver/stm32", "lvstm32.py")

View File

@ -53,6 +53,9 @@
#include "stm32f7xx_hal_uart.h"
#include "stm32f7xx_hal_usart.h"
#include "stm32f7xx_hal_wwdg.h"
#include "stm32f7xx_hal_ltdc.h"
#include "stm32f7xx_hal_ltdc_ex.h"
#include "stm32f7xx_hal_dma2d.h"
// Enable various HAL modules
#define HAL_ADC_MODULE_ENABLED
@ -81,6 +84,8 @@
#define HAL_UART_MODULE_ENABLED
#define HAL_USART_MODULE_ENABLED
#define HAL_WWDG_MODULE_ENABLED
#define HAL_LTDC_MODULE_ENABLED
#define HAL_DMA2D_MODULE_ENABLED
// Oscillator values in Hz
#define HSI_VALUE (16000000)

View File

@ -126,7 +126,7 @@
#endif
#define MICROPY_PY_UERRNO (1)
#ifndef MICROPY_PY_THREAD
#define MICROPY_PY_THREAD (0)
#define MICROPY_PY_THREAD (1)
#endif
// extended modules
@ -173,7 +173,9 @@
#ifndef MICROPY_PY_NETWORK
#define MICROPY_PY_NETWORK (1)
#endif
#define MICROPY_PY_LVGL (1)
//#define MICROPY_PY_LVGL (1)
#define MICROPY_PY_LODEPNG (1)
#define MICROPY_PY_RK043FN48H (1)
// fatfs configuration used in ffconf.h
#define MICROPY_FATFS_ENABLE_LFN (1)
@ -211,6 +213,7 @@ extern const struct _mp_obj_module_t mp_module_usocket;
extern const struct _mp_obj_module_t mp_module_network;
extern const struct _mp_obj_module_t mp_module_onewire;
extern const struct _mp_obj_module_t mp_module_lvgl;
extern const struct _mp_obj_module_t mp_module_lodepng;
#if MICROPY_PY_LVGL
#define MICROPY_PORT_LVGL_DEF \
@ -220,6 +223,12 @@ extern const struct _mp_obj_module_t mp_module_lvgl;
#define MICROPY_PORT_LVGL_DEF
#endif
#if MICROPY_PY_LODEPNG
#define MICROPY_PORT_LODEPNG_DEF { MP_OBJ_NEW_QSTR(MP_QSTR_lodepng), (mp_obj_t)&mp_module_lodepng },
#else
#define MICROPY_PORT_LODEPNG_DEF
#endif
#if MICROPY_PY_STM
#define STM_BUILTIN_MODULE { MP_ROM_QSTR(MP_QSTR_stm), MP_ROM_PTR(&stm_module) },
#else
@ -252,6 +261,7 @@ extern const struct _mp_obj_module_t mp_module_lvgl;
SOCKET_BUILTIN_MODULE \
NETWORK_BUILTIN_MODULE \
MICROPY_PORT_LVGL_DEF \
MICROPY_PORT_LODEPNG_DEF \
{ MP_ROM_QSTR(MP_QSTR__onewire), MP_ROM_PTR(&mp_module_onewire) }, \
// extra constants
@ -269,6 +279,12 @@ extern const struct _mp_obj_module_t mp_module_lvgl;
#define LV_ROOTS
#endif
#if MICROPY_PY_RK043FN48H
#define RK043FN48H_ROOTS void* rk043fn48h_fb[2];
#else
#define RK043FN48H_ROOTS
#endif
#if MICROPY_SSL_MBEDTLS
#define MICROPY_PORT_ROOT_POINTER_MBEDTLS void **mbedtls_memory;
#else
@ -285,6 +301,7 @@ struct _mp_bluetooth_nimble_root_pointers_t;
#define MICROPY_PORT_ROOT_POINTERS \
LV_ROOTS \
void *mp_lv_user_data; \
RK043FN48H_ROOTS \
const char *readline_hist[8]; \
\
mp_obj_t pyb_hid_report_desc; \

View File

@ -887,3 +887,17 @@ void I2C4_ER_IRQHandler(void) {
#endif // defined(MICROPY_HW_I2C4_SCL)
#endif // MICROPY_PY_PYB_LEGACY
#if defined(HAL_DMA2D_MODULE_ENABLED)
extern DMA2D_HandleTypeDef *hdma2d;
void DMA2D_IRQHandler(void) {
HAL_DMA2D_IRQHandler(hdma2d);
}
#endif
#if defined(HAL_LTDC_MODULE_ENABLED)
extern LTDC_HandleTypeDef *hltdc;
void LTDC_IRQHandler(void) {
HAL_LTDC_IRQHandler(hltdc);
}
#endif

View File

@ -43,17 +43,25 @@ SRC_C = \
fmode.c \
$(SRC_MOD)
LIB_SRC_C = $(addprefix lib/,\
lv_bindings/driver/SDL/SDL_monitor.c \
lv_bindings/driver/SDL/SDL_mouse.c \
lv_bindings/driver/SDL/modSDL.c \
timeutils/timeutils.c \
)
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
ifeq ($(MICROPY_USE_READLINE),1)
CFLAGS_MOD += -DMICROPY_USE_READLINE=1
SRC_C += lib/mp-readline/readline.c
endif
LIB += -lws2_32
LIB += -lws2_32 -lSDL2
# List of sources for qstr extraction
SRC_QSTR += $(SRC_C)
SRC_QSTR += $(SRC_C) $(LIB_SRC_C)
# Append any auto-generated sources that are needed by sources listed in
# SRC_QSTR
SRC_QSTR_AUTO_DEPS +=

View File

@ -7,6 +7,11 @@ consider to contribute.
Building on Debian/Ubuntu Linux system
---------------------------------------
Install SDL mingw port from sdl.org:
https://www.libsdl.org/release/SDL2-devel-2.0.12-mingw.tar.gz
Install mingw gcc toolchain and build:
sudo apt-get install gcc-mingw-w64
make CROSS_COMPILE=i686-w64-mingw32-

View File

@ -43,10 +43,11 @@
#define MICROPY_ENABLE_FINALISER (1)
#define MICROPY_ENABLE_PYSTACK (1)
#define MICROPY_STACK_CHECK (1)
#define MICROPY_MALLOC_USES_ALLOCATED_SIZE (1)
#define MICROPY_MEM_STATS (1)
#define MICROPY_MALLOC_USES_ALLOCATED_SIZE (0)
#define MICROPY_MEM_STATS (0)
#define MICROPY_DEBUG_PRINTER (&mp_stderr_print)
#define MICROPY_DEBUG_PRINTERS (1)
#define MICROPY_ENABLE_SCHEDULER (1)
#define MICROPY_READER_POSIX (1)
#define MICROPY_USE_READLINE_HISTORY (1)
#define MICROPY_HELPER_REPL (1)
@ -109,6 +110,7 @@
#define MICROPY_PY_UBINASCII (1)
#define MICROPY_PY_UBINASCII_CRC32 (1)
#define MICROPY_PY_URANDOM (1)
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1)
#define MICROPY_PY_MACHINE (1)
#define MICROPY_PY_MACHINE_PULSE (1)
#define MICROPY_MACHINE_MEM_GET_READ_ADDR mod_machine_mem_get_addr
@ -118,6 +120,9 @@
#define MICROPY_ERROR_PRINTER (&mp_stderr_print)
#define MICROPY_WARNINGS (1)
#define MICROPY_PY_STR_BYTES_CMP_WARN (1)
//use large block for GC to increase speed of allocate, but consume more memory
#define MICROPY_BYTES_PER_GC_BLOCK (64 * BYTES_PER_WORD)
extern const struct _mp_print_t mp_stderr_print;
@ -133,6 +138,37 @@ extern const struct _mp_print_t mp_stderr_print;
#define MICROPY_PORT_INIT_FUNC init()
#define MICROPY_PORT_DEINIT_FUNC deinit()
//LVGL binding relative
#define MICROPY_PY_LVGL (1)
#define MICROPY_PY_LVGL_SDL (1)
#define MICROPY_PY_LVGL_LODEPNG (1)
extern const struct _mp_obj_module_t mp_module_machine;
extern const struct _mp_obj_module_t mp_module_os;
extern const struct _mp_obj_module_t mp_module_uos_vfs;
extern const struct _mp_obj_module_t mp_module_lvgl;
extern const struct _mp_obj_module_t mp_module_lvindev;
extern const struct _mp_obj_module_t mp_module_SDL;
extern const struct _mp_obj_module_t mp_module_lodepng;
#if MICROPY_PY_LVGL
#include "lib/lv_bindings/lvgl/src/lv_misc/lv_gc.h"
#define MICROPY_PY_LVGL_DEF { MP_OBJ_NEW_QSTR(MP_QSTR_lvgl), (mp_obj_t)&mp_module_lvgl },
#if MICROPY_PY_LVGL_SDL
#define MICROPY_PY_LVGL_SDL_DEF { MP_OBJ_NEW_QSTR(MP_QSTR_SDL), (mp_obj_t)&mp_module_SDL },
#else
#define MICROPY_PY_LVGL_SDL_DEF
#endif
#if MICROPY_PY_LVGL_LODEPNG
#define MICROPY_PY_LVGL_LODEPNG_DEF { MP_OBJ_NEW_QSTR(MP_QSTR_lodepng), (mp_obj_t)&mp_module_lodepng },
#else
#define MICROPY_PY_LVGL_LODEPNG_DEF
#endif
#else
#define LV_ROOTS
#define MICROPY_PY_LVGL_DEF
#endif
// type definitions for the specific machine
#if defined( __MINGW32__ ) && defined( __LP64__ )
@ -178,13 +214,19 @@ void mp_hal_dupterm_tx_strn(const char *str, size_t len);
extern const struct _mp_obj_module_t mp_module_os;
extern const struct _mp_obj_module_t mp_module_time;
#define MICROPY_PORT_BUILTIN_MODULES \
{ MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_time) }, \
{ MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, \
{ MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_os) }, \
MICROPY_PY_LVGL_DEF \
MICROPY_PY_LVGL_SDL_DEF \
MICROPY_PY_LVGL_LODEPNG_DEF
#if MICROPY_USE_READLINE == 1
#define MICROPY_PORT_ROOT_POINTERS \
LV_ROOTS \
void *mp_lv_user_data; \
char *readline_hist[50];
#endif