From 7c926ad2b476e00556ea7bd40ddd76a1cdc9ddd5 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Thu, 22 Apr 2021 01:16:50 -0400 Subject: [PATCH] progress? --- ext/ext.mk | 2 +- ...{board_stm32f4chibios.h.dis => board_stm32f4chibios.h} | 0 ext/platform_chibios/cpu_chibios_cpu.h | 4 ++++ ext/platform_chibios/git_version.h | 2 ++ ext/platform_chibios/platform.c | 8 +++++--- .../{platform_conf.h.dis => platform_conf.h} | 8 +++++--- ext/platform_chibios/platform_generic.h | 1 + halconf.h | 7 +++++++ 8 files changed, 25 insertions(+), 7 deletions(-) rename ext/platform_chibios/{board_stm32f4chibios.h.dis => board_stm32f4chibios.h} (100%) create mode 100644 ext/platform_chibios/git_version.h rename ext/platform_chibios/{platform_conf.h.dis => platform_conf.h} (96%) diff --git a/ext/ext.mk b/ext/ext.mk index dea523f..26bd625 100644 --- a/ext/ext.mk +++ b/ext/ext.mk @@ -135,9 +135,9 @@ ELUA_EXT_OBJS= $(BUILDDIR)/obj/ch_lua.o.ext $(BUILDDIR)/obj/elua_chibios_mod.o.e EXT_INC = $(CHIBIOSLUA)/ext \ + $(CHIBIOSLUA)/ext/platform_chibios \ $(ELUA)/inc \ $(ELUA)/inc/newlib \ - $(CHIBIOSLUA)/ext/platform_chibios \ $(ELUA)/src/lua \ $(ELUA)/src/modules \ $(ELUA)/boards/headers \ diff --git a/ext/platform_chibios/board_stm32f4chibios.h.dis b/ext/platform_chibios/board_stm32f4chibios.h similarity index 100% rename from ext/platform_chibios/board_stm32f4chibios.h.dis rename to ext/platform_chibios/board_stm32f4chibios.h diff --git a/ext/platform_chibios/cpu_chibios_cpu.h b/ext/platform_chibios/cpu_chibios_cpu.h index 546dc55..dfcea36 100644 --- a/ext/platform_chibios/cpu_chibios_cpu.h +++ b/ext/platform_chibios/cpu_chibios_cpu.h @@ -1,5 +1,8 @@ // i386 (Intel) CPU configuration +#include "ch.h" +#include "hal.h" + #ifndef __CPU_I386_H__ #define __CPU_I386_H__ @@ -13,6 +16,7 @@ #define NUM_PWM 0 #define NUM_ADC 0 #define NUM_CAN 0 +#define SERMUX_SERVICE_ID_FIRST 0 // CPU frequency (needed by the CPU module and MMCFS code, 0 if not used) #define CPU_FREQUENCY 0 diff --git a/ext/platform_chibios/git_version.h b/ext/platform_chibios/git_version.h new file mode 100644 index 0000000..dd5caa8 --- /dev/null +++ b/ext/platform_chibios/git_version.h @@ -0,0 +1,2 @@ + +#define ELUA_STR_VERSION "unknown" \ No newline at end of file diff --git a/ext/platform_chibios/platform.c b/ext/platform_chibios/platform.c index eed8b62..444b375 100644 --- a/ext/platform_chibios/platform.c +++ b/ext/platform_chibios/platform.c @@ -1,5 +1,7 @@ // Platform-dependent functions +#include "ch.h" +#include "hal.h" #include "platform.h" #include "type.h" #include "devman.h" @@ -16,7 +18,7 @@ #include "utils.h" #include "common.h" #include "platform_conf.h" -#include "hal.h" +#include "platform_generic.h" // **************************************************************************** // Platform initialization @@ -52,12 +54,12 @@ pio_type platform_pio_op( unsigned port, pio_type pinmask, int op ) case PLATFORM_IO_PORT_DIR_OUTPUT: new_state &= ~(ignore_pins[port]);//exclude some pins - palSetGroupMode(target_port,new_state, 0, PAL_STM32_MODE_OUTPUT | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_MID1 | PAL_STM32_PUDR_FLOATING ); + palSetGroupMode(target_port,new_state, 0, PAL_STM32_MODE_OUTPUT | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_MID1 | PAL_STM32_PUPDR_FLOATING ); break; case PLATFORM_IO_PORT_DIR_INPUT: new_state &= ~(ignore_pins[port]);//exclude some pins - palSetGroupMode(target_port,new_state, 0, PAL_STM32_MODE_INPUT | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_MID1 | PAL_STM32_PUDR_FLOATING ); + palSetGroupMode(target_port,new_state, 0, PAL_STM32_MODE_INPUT | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_MID1 | PAL_STM32_PUPDR_FLOATING ); break; case PLATFORM_IO_PORT_GET_VALUE: diff --git a/ext/platform_chibios/platform_conf.h.dis b/ext/platform_chibios/platform_conf.h similarity index 96% rename from ext/platform_chibios/platform_conf.h.dis rename to ext/platform_chibios/platform_conf.h index a2c38bb..a2d5669 100644 --- a/ext/platform_chibios/platform_conf.h.dis +++ b/ext/platform_chibios/platform_conf.h @@ -3,6 +3,9 @@ #ifndef __PLATFORM_CONF_H__ #define __PLATFORM_CONF_H__ +#include "cpu_chibios_cpu.h" +#include "board_stm32f4chibios.h" + #include "auxmods.h" #include "type.h" #include "stacks.h" @@ -10,7 +13,7 @@ #define BUILD_CON_GENERIC #define BUILD_SHELL #define BUILD_TERM -#define BUILD_ROMFS +#undef BUILD_ROMFS #define BUILD_XMODEM #define BUILD_LINENOISE @@ -80,8 +83,7 @@ {LUA_OSLIBNAME, luaopen_os},\ {LUA_STRLIBNAME, luaopen_string },\ {LUA_MATHLIBNAME, luaopen_math },\ - {LUA_DBLIBNAME, luaopen_debug }, \ - {AUXLIB_CHIBIOS, luaopen_chibios, ch_thread_map} + {LUA_DBLIBNAME, luaopen_debug } #define LUA_PLATFORM_LIBS_ROM\ _ROM( AUXLIB_PIO, luaopen_pio, pio_map )\ diff --git a/ext/platform_chibios/platform_generic.h b/ext/platform_chibios/platform_generic.h index d09ac7b..59965ac 100644 --- a/ext/platform_chibios/platform_generic.h +++ b/ext/platform_chibios/platform_generic.h @@ -4,6 +4,7 @@ #define __PLATFORM_GENERIC_H__ #include "ch.h" +#include "hal.h" //~ #define PLATFORM_TMR_COUNTS_DOWN extern BaseSequentialStream *eLuaSDriver; diff --git a/halconf.h b/halconf.h index 9a54550..de85967 100644 --- a/halconf.h +++ b/halconf.h @@ -526,6 +526,13 @@ #define WSPI_USE_MUTUAL_EXCLUSION TRUE #endif +/** + * elua + */ +//~ #define CHIBILUA_SERIAL 1 +#define CHIBILUA_USBSERIAL 1 + + #endif /* HALCONF_H */ /** @} */