mirror of
https://github.com/elua/elua.git
synced 2025-01-08 20:56:17 +08:00
Multiple changes
- platform 'sim' switched to the new build system - fixed a few macro definitions
This commit is contained in:
parent
dd12c470a7
commit
a26d5423e1
16
boards/known/sim.lua
Normal file
16
boards/known/sim.lua
Normal file
@ -0,0 +1,16 @@
|
||||
-- eLua simulator running on linux
|
||||
|
||||
return {
|
||||
cpu = 'linux',
|
||||
components = {
|
||||
sercon = { uart = 0, speed = 0 },
|
||||
wofs = true,
|
||||
romfs = true,
|
||||
shell = true,
|
||||
term = { lines = 25, cols = 80 },
|
||||
},
|
||||
modules = {
|
||||
generic = { 'pd', 'math', 'term', 'elua' }
|
||||
}
|
||||
}
|
||||
|
@ -134,10 +134,6 @@ local sanity_code = [[
|
||||
#define VTMR_NUM_TIMERS 0
|
||||
#endif // #ifndef VTMR_NUM_TIMERS
|
||||
|
||||
#ifndef CON_BUF_SIZE
|
||||
#define CON_BUF_SIZE 0
|
||||
#endif // #ifndef CON_BUF_SIZE
|
||||
|
||||
#ifndef SERMUX_FLOW_TYPE
|
||||
#define SERMUX_FLOW_TYPE PLATFORM_UART_FLOW_NONE
|
||||
#endif
|
||||
@ -152,15 +148,15 @@ local sanity_code = [[
|
||||
|
||||
#ifdef ELUA_BOOT_RPC
|
||||
#ifndef RPC_UART_ID
|
||||
#define RPC_UART_ID CON_UART_ID
|
||||
#define RPC_UART_ID CON_UART_ID
|
||||
#endif
|
||||
|
||||
#ifndef RPC_TIMER_ID
|
||||
#define RPC_TIMER_ID PLATFORM_TIMER_SYS_ID
|
||||
#define RPC_TIMER_ID PLATFORM_TIMER_SYS_ID
|
||||
#endif
|
||||
|
||||
#ifndef RPC_UART_SPEED
|
||||
#define RPC_UART_SPEED CON_UART_SPEED
|
||||
#define RPC_UART_SPEED CON_UART_SPEED
|
||||
#endif
|
||||
#endif // #ifdef ELUA_BOOT_RPC
|
||||
|
||||
@ -172,6 +168,10 @@ local sanity_code = [[
|
||||
#define BUF_ENABLE_ADC
|
||||
#endif
|
||||
|
||||
#ifndef CPU_FREQUENCY
|
||||
#define CPU_FREQUENCY 0
|
||||
#endif
|
||||
|
||||
]]
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
@ -4,7 +4,7 @@
|
||||
stty -echo raw -igncr
|
||||
|
||||
# Run simulator
|
||||
./elua_lua$1_linux.elf
|
||||
./elua_lua$1_sim.elf
|
||||
|
||||
# Restore terminal to default settings
|
||||
stty echo cooked
|
||||
|
@ -24,6 +24,10 @@
|
||||
extern const elua_int_descriptor elua_int_table[ INT_ELUA_LAST ];
|
||||
#endif // #ifdef BUILD_INT_HANDLERS
|
||||
|
||||
#ifndef CON_BUF_SIZE
|
||||
#define CON_BUF_SIZE 0
|
||||
#endif // #ifndef CON_BUF_SIZE
|
||||
|
||||
// ****************************************************************************
|
||||
// XMODEM support code
|
||||
|
||||
|
32
src/platform/sim/cpu_linux.h
Normal file
32
src/platform/sim/cpu_linux.h
Normal file
@ -0,0 +1,32 @@
|
||||
// Linux "CPU" description for the eLua simulator
|
||||
|
||||
#ifndef __CPU_LINUX_H__
|
||||
#define __CPU_LINUX_H__
|
||||
|
||||
// Number of resources (0 if not available/not implemented)
|
||||
#define NUM_PIO 0
|
||||
#define NUM_SPI 0
|
||||
#define NUM_UART 0
|
||||
#define NUM_TIMER 0
|
||||
#define NUM_PWM 0
|
||||
#define NUM_ADC 0
|
||||
#define NUM_CAN 0
|
||||
|
||||
// PIO prefix ('0' for P0, P1, ... or 'A' for PA, PB, ...)
|
||||
#define PIO_PREFIX 'A'
|
||||
// Pins per port configuration:
|
||||
// #define PIO_PINS_PER_PORT (n) if each port has the same number of pins, or
|
||||
// #define PIO_PIN_ARRAY { n1, n2, ... } to define pins per port in an array
|
||||
// Use #define PIO_PINS_PER_PORT 0 if this isn't needed
|
||||
#define PIO_PINS_PER_PORT 0
|
||||
|
||||
// Allocator data: define your free memory zones here in two arrays
|
||||
// (start address and end address)
|
||||
extern void *memory_start_address;
|
||||
extern void *memory_end_address;
|
||||
#define MEM_LENGTH (1024 * 1024)
|
||||
#define INTERNAL_RAM_FIRST_FREE ( void* )memory_start_address
|
||||
#define INTERNAL_RAM_LAST_FREE ( void* )memory_end_address
|
||||
|
||||
#endif
|
||||
|
@ -1,78 +0,0 @@
|
||||
// eLua platform configuration
|
||||
|
||||
#ifndef __PLATFORM_CONF_H__
|
||||
#define __PLATFORM_CONF_H__
|
||||
|
||||
#include "auxmods.h"
|
||||
#include "type.h"
|
||||
#include "stacks.h"
|
||||
#include "buf.h"
|
||||
|
||||
// *****************************************************************************
|
||||
// Define here what components you want for this platform
|
||||
|
||||
#define BUILD_SHELL
|
||||
#define BUILD_ROMFS
|
||||
#define BUILD_CON_GENERIC
|
||||
#define BUILD_TERM
|
||||
//#define BUILD_RFS
|
||||
#define BUILD_WOFS
|
||||
|
||||
#define TERM_LINES 25
|
||||
#define TERM_COLS 80
|
||||
|
||||
#define PLATFORM_HAS_SYSTIMER
|
||||
|
||||
// *****************************************************************************
|
||||
// Auxiliary libraries that will be compiled for this platform
|
||||
|
||||
#define LUA_PLATFORM_LIBS_ROM\
|
||||
_ROM( AUXLIB_PD, luaopen_pd, pd_map )\
|
||||
_ROM( LUA_MATHLIBNAME, luaopen_math, math_map )\
|
||||
_ROM( AUXLIB_TERM, luaopen_term, term_map )\
|
||||
_ROM( AUXLIB_ELUA, luaopen_elua, elua_map )\
|
||||
_ROM( AUXLIB_TMR, luaopen_tmr, tmr_map )\
|
||||
|
||||
// Bogus defines for common.c
|
||||
#define CON_UART_ID 0
|
||||
#define CON_UART_SPEED 0
|
||||
|
||||
// *****************************************************************************
|
||||
// Configuration data
|
||||
|
||||
// Virtual timers (0 if not used)
|
||||
#define VTMR_NUM_TIMERS 0
|
||||
|
||||
// Number of resources (0 if not available/not implemented)
|
||||
#define NUM_PIO 0
|
||||
#define NUM_SPI 0
|
||||
#define NUM_UART 0
|
||||
#define NUM_TIMER 0
|
||||
#define NUM_PWM 0
|
||||
#define NUM_ADC 0
|
||||
#define NUM_CAN 0
|
||||
|
||||
// CPU frequency (needed by the CPU module and MMCFS code, 0 if not used)
|
||||
#define CPU_FREQUENCY 0
|
||||
|
||||
// PIO prefix ('0' for P0, P1, ... or 'A' for PA, PB, ...)
|
||||
#define PIO_PREFIX 'A'
|
||||
// Pins per port configuration:
|
||||
// #define PIO_PINS_PER_PORT (n) if each port has the same number of pins, or
|
||||
// #define PIO_PIN_ARRAY { n1, n2, ... } to define pins per port in an array
|
||||
// Use #define PIO_PINS_PER_PORT 0 if this isn't needed
|
||||
#define PIO_PINS_PER_PORT 0
|
||||
|
||||
// Allocator data: define your free memory zones here in two arrays
|
||||
// (start address and end address)
|
||||
extern void *memory_start_address;
|
||||
extern void *memory_end_address;
|
||||
#define MEM_LENGTH (1024 * 1024)
|
||||
#define MEM_START_ADDRESS { ( void* )memory_start_address }
|
||||
#define MEM_END_ADDRESS { ( void* )memory_end_address }
|
||||
|
||||
// RFS configuration
|
||||
#define RFS_TIMEOUT 0 // dummy, always blocking by implementation
|
||||
#define RFS_BUFFER_SIZE BUF_SIZE_512
|
||||
|
||||
#endif // #ifndef __PLATFORM_CONF_H__
|
9
src/platform/sim/platform_generic.h
Normal file
9
src/platform/sim/platform_generic.h
Normal file
@ -0,0 +1,9 @@
|
||||
// Included by platform_conf.h for platform customizations
|
||||
|
||||
#ifndef __PLATFORM_GENERIC_H__
|
||||
#define __PLATFORM_GENERIC_H__
|
||||
|
||||
#define PLATFORM_HAS_SYSTIMER
|
||||
|
||||
#endif // #ifndef __PLATFORM_GENERIC_H__
|
||||
|
@ -1,7 +1,7 @@
|
||||
// CPU definition file for STM32F103RE
|
||||
|
||||
#ifndef __STM32F103RE_H__
|
||||
#define __STM32F103RE_H__
|
||||
#ifndef __CPU_STM32F103RE_H__
|
||||
#define __CPU_STM32F103RE_H__
|
||||
|
||||
#include "type.h"
|
||||
#include "stacks.h"
|
||||
@ -47,5 +47,5 @@ u32 platform_s_cpu_get_frequency();
|
||||
_C( INT_TMR_MATCH ), \
|
||||
_C( INT_UART_RX ),
|
||||
|
||||
#endif // #ifndef __STM32F103RE_H__
|
||||
#endif // #ifndef __CPU_STM32F103RE_H__
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
// CPU definition file for STM32F103ZE
|
||||
// Use the STM32F103RE description as a base
|
||||
|
||||
#ifndef __STM32F103ZE_H__
|
||||
#define __STM32F103ZE_H__
|
||||
#ifndef __CPU_STM32F103ZE_H__
|
||||
#define __CPU_STM32F103ZE_H__
|
||||
|
||||
#include "cpu_stm32f103re.h"
|
||||
|
||||
@ -10,5 +10,5 @@
|
||||
#undef NUM_ADC
|
||||
#define NUM_ADC 21
|
||||
|
||||
#endif // #ifndef __STM32F103ZE_H__
|
||||
#endif // #ifndef __CPU_STM32F103ZE_H__
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user