Skip to content

Commit

Permalink
Multiple changes
Browse files Browse the repository at this point in the history
- platform 'sim' switched to the new build system
- fixed a few macro definitions
  • Loading branch information
bogdanm committed Jul 12, 2012
1 parent dd12c47 commit a26d542
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 92 deletions.
16 changes: 16 additions & 0 deletions boards/known/sim.lua
@@ -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' }
}
}

14 changes: 7 additions & 7 deletions config/config.lua
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -172,6 +168,10 @@ local sanity_code = [[
#define BUF_ENABLE_ADC
#endif
#ifndef CPU_FREQUENCY
#define CPU_FREQUENCY 0
#endif
]]

-------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion run_elua_sim.sh
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/common.c
Expand Up @@ -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

Expand Down
32 changes: 32 additions & 0 deletions src/platform/sim/cpu_linux.h
@@ -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

78 changes: 0 additions & 78 deletions src/platform/sim/platform_conf.h

This file was deleted.

9 changes: 9 additions & 0 deletions src/platform/sim/platform_generic.h
@@ -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__

6 changes: 3 additions & 3 deletions src/platform/stm32/cpu_stm32f103re.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"
Expand Down Expand Up @@ -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__

6 changes: 3 additions & 3 deletions src/platform/stm32/cpu_stm32f103ze.h
@@ -1,14 +1,14 @@
// 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"

// 21 ADCs instead of 16
#undef NUM_ADC
#define NUM_ADC 21

#endif // #ifndef __STM32F103ZE_H__
#endif // #ifndef __CPU_STM32F103ZE_H__

0 comments on commit a26d542

Please sign in to comment.