mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
Moved platform 'at91sam7x' to the new build system
Also, a small fix in the timer interrupt handling code.
This commit is contained in:
parent
97d9cac313
commit
5cf6f2b8f3
25
boards/known/netduino.lua
Normal file
25
boards/known/netduino.lua
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
-- Netduino build configuration
|
||||||
|
|
||||||
|
return {
|
||||||
|
cpu = 'at91sam7x512',
|
||||||
|
components = {
|
||||||
|
sercon = { uart = 0, speed = 115200, buf_size = 128 },
|
||||||
|
romfs = true,
|
||||||
|
shell = true,
|
||||||
|
term = { lines = 25, cols = 80 },
|
||||||
|
cints = true,
|
||||||
|
luaints = true,
|
||||||
|
linenoise = { shell_lines = 10, lua_lines = 50 },
|
||||||
|
rpc = { uart = 0, speed = 115200 },
|
||||||
|
xmodem = true
|
||||||
|
},
|
||||||
|
config = {
|
||||||
|
egc = { mode = "alloc" },
|
||||||
|
vtmr = { num = 4, freq = 4 },
|
||||||
|
},
|
||||||
|
modules = {
|
||||||
|
generic = 'all',
|
||||||
|
exclude_generic = { "i2c", "net", "adc", "spi", "can" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
25
boards/known/sam7-ex256.lua
Normal file
25
boards/known/sam7-ex256.lua
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
-- SAM7-EX256 build configuration
|
||||||
|
|
||||||
|
return {
|
||||||
|
cpu = 'at91sam7x256',
|
||||||
|
components = {
|
||||||
|
sercon = { uart = 0, speed = 115200, buf_size = 128 },
|
||||||
|
romfs = true,
|
||||||
|
shell = true,
|
||||||
|
term = { lines = 25, cols = 80 },
|
||||||
|
cints = true,
|
||||||
|
luaints = true,
|
||||||
|
linenoise = { shell_lines = 10, lua_lines = 50 },
|
||||||
|
rpc = { uart = 0, speed = 115200 },
|
||||||
|
xmodem = true
|
||||||
|
},
|
||||||
|
config = {
|
||||||
|
egc = { mode = "alloc" },
|
||||||
|
vtmr = { num = 4, freq = 4 },
|
||||||
|
},
|
||||||
|
modules = {
|
||||||
|
generic = 'all',
|
||||||
|
exclude_generic = { "i2c", "net", "adc", "spi", "can" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,22 +9,9 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
// [TODO] when the new build system is ready, automatically add the
|
#ifdef BUILD_INT_HANDLERS
|
||||||
// code below in platform_conf.h
|
|
||||||
#if defined( BUILD_LUA_INT_HANDLERS ) || defined( BUILD_C_INT_HANDLERS )
|
|
||||||
#define BUILD_INT_HANDLERS
|
|
||||||
|
|
||||||
#ifndef INT_TMR_MATCH
|
|
||||||
#define INT_TMR_MATCH ELUA_INT_INVALID_INTERRUPT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern const elua_int_descriptor elua_int_table[ INT_ELUA_LAST ];
|
extern const elua_int_descriptor elua_int_table[ INT_ELUA_LAST ];
|
||||||
|
#endif // #ifdef BUILD_INT_HANDLERS
|
||||||
#endif // #if defined( BUILD_LUA_INT_HANDLERS ) || defined( BUILD_C_INT_HANDLERS )
|
|
||||||
|
|
||||||
#ifndef VTMR_NUM_TIMERS
|
|
||||||
#define VTMR_NUM_TIMERS 0
|
|
||||||
#endif // #ifndef VTMR_NUM_TIMERS
|
|
||||||
|
|
||||||
#ifndef PLATFORM_HAS_SYSTIMER
|
#ifndef PLATFORM_HAS_SYSTIMER
|
||||||
#warning This platform does not have a system timer. Your eLua image might not work as expected.
|
#warning This platform does not have a system timer. Your eLua image might not work as expected.
|
||||||
@ -335,7 +322,11 @@ int platform_timer_set_match_int( unsigned id, timer_data_type period_us, int ty
|
|||||||
if( id == PLATFORM_TIMER_SYS_ID )
|
if( id == PLATFORM_TIMER_SYS_ID )
|
||||||
return PLATFORM_TIMER_INT_INVALID_ID;
|
return PLATFORM_TIMER_INT_INVALID_ID;
|
||||||
else
|
else
|
||||||
|
#if INT_TMR_MATCH != ELUA_INT_INVALID_INTERRUPT
|
||||||
return platform_s_timer_set_match_int( id, period_us, type );
|
return platform_s_timer_set_match_int( id, period_us, type );
|
||||||
|
#else
|
||||||
|
return PLATFORM_TIMER_INT_INVALID_ID;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmn_tmr_int_set_status( elua_int_resnum resnum, int status )
|
int cmn_tmr_int_set_status( elua_int_resnum resnum, int status )
|
||||||
|
41
src/platform/at91sam7x/cpu_at91sam7x256.h
Normal file
41
src/platform/at91sam7x/cpu_at91sam7x256.h
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
// AT91SAM7X256 CPU definition
|
||||||
|
|
||||||
|
#ifndef __CPU_AT91SAM7X256__
|
||||||
|
#define __CPU_AT91SAM7X256__
|
||||||
|
|
||||||
|
#include "stacks.h"
|
||||||
|
#include "platform_ints.h"
|
||||||
|
#include "board.h"
|
||||||
|
|
||||||
|
// Number of resources (0 if not available/not implemented)
|
||||||
|
#define NUM_PIO 2
|
||||||
|
#define NUM_SPI 0
|
||||||
|
#define NUM_UART 2
|
||||||
|
#define NUM_TIMER 3
|
||||||
|
#define NUM_PWM 4
|
||||||
|
#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 BOARD_MCK
|
||||||
|
|
||||||
|
// 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 31
|
||||||
|
|
||||||
|
#define SRAM_ORIGIN 0x200000
|
||||||
|
#ifndef SRAM_SIZE
|
||||||
|
#define SRAM_SIZE 0x10000
|
||||||
|
#endif
|
||||||
|
#define INTERNAL_RAM_FIRST_FREE end
|
||||||
|
#define INTERNAL_RAM_LAST_FREE ( SRAM_ORIGIN + SRAM_SIZE - STACK_SIZE_TOTAL - 1 )
|
||||||
|
|
||||||
|
#define PLATFORM_CPU_CONSTANTS_INTS\
|
||||||
|
_C( INT_UART_RX ),
|
||||||
|
|
||||||
|
#endif // #ifndef __CPU_AT91SAM7X256__
|
||||||
|
|
12
src/platform/at91sam7x/cpu_at91sam7x512.h
Normal file
12
src/platform/at91sam7x/cpu_at91sam7x512.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// AT91SAM7X512 CPU definition
|
||||||
|
// Use AT91SAM7X256 as a base
|
||||||
|
|
||||||
|
#ifndef __CPU_AT91SAM7X512_H__
|
||||||
|
#define __CPU_AT91SAM7X512_H__
|
||||||
|
|
||||||
|
#define SRAM_SIZE 0x20000
|
||||||
|
|
||||||
|
#include "cpu_at91sam7x256.h"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -1,133 +0,0 @@
|
|||||||
// eLua platform configuration
|
|
||||||
|
|
||||||
#ifndef __PLATFORM_CONF_H__
|
|
||||||
#define __PLATFORM_CONF_H__
|
|
||||||
|
|
||||||
#include "auxmods.h"
|
|
||||||
#include "board.h"
|
|
||||||
#include "stacks.h"
|
|
||||||
#include "buf.h"
|
|
||||||
#include "elua_int.h"
|
|
||||||
#include "sermux.h"
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// Define here what components you want for this platform
|
|
||||||
|
|
||||||
#define BUILD_XMODEM
|
|
||||||
#define BUILD_SHELL
|
|
||||||
#define BUILD_ROMFS
|
|
||||||
#define BUILD_TERM
|
|
||||||
#define BUILD_CON_GENERIC
|
|
||||||
//#define BUILD_RPC
|
|
||||||
//#define BUILD_RFS
|
|
||||||
//#define BUILD_SERMUX
|
|
||||||
#define BUILD_C_INT_HANDLERS
|
|
||||||
|
|
||||||
#define PLATFORM_HAS_SYSTIMER
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// UART/Timer IDs configuration data (used in main.c)
|
|
||||||
|
|
||||||
//#define CON_UART_ID ( SERMUX_SERVICE_ID_FIRST + 1 )
|
|
||||||
#define CON_UART_ID 0
|
|
||||||
#define CON_UART_SPEED 115200
|
|
||||||
#define TERM_LINES 25
|
|
||||||
#define TERM_COLS 80
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// Auxiliary libraries that will be compiled for this platform
|
|
||||||
|
|
||||||
#if defined( ELUA_BOOT_RPC ) && !defined( BUILD_RPC )
|
|
||||||
#define BUILD_RPC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined( BUILD_RPC )
|
|
||||||
#define RPCLINE _ROM( AUXLIB_RPC, luaopen_rpc, rpc_map )
|
|
||||||
#else
|
|
||||||
#define RPCLINE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LUA_PLATFORM_LIBS_ROM\
|
|
||||||
_ROM( AUXLIB_PIO, luaopen_pio, pio_map )\
|
|
||||||
_ROM( AUXLIB_TMR, luaopen_tmr, tmr_map )\
|
|
||||||
_ROM( AUXLIB_PD, luaopen_pd, pd_map )\
|
|
||||||
_ROM( AUXLIB_UART, luaopen_uart, uart_map )\
|
|
||||||
_ROM( AUXLIB_TERM, luaopen_term, term_map )\
|
|
||||||
_ROM( AUXLIB_PWM, luaopen_pwm, pwm_map )\
|
|
||||||
_ROM( AUXLIB_PACK, luaopen_pack, pack_map )\
|
|
||||||
_ROM( AUXLIB_BIT, luaopen_bit, bit_map )\
|
|
||||||
_ROM( AUXLIB_CPU, luaopen_cpu, cpu_map )\
|
|
||||||
_ROM( AUXLIB_ELUA, luaopen_elua, elua_map )\
|
|
||||||
RPCLINE\
|
|
||||||
_ROM( LUA_MATHLIBNAME, luaopen_math, math_map )
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// Configuration data
|
|
||||||
|
|
||||||
// Virtual timers (0 if not used)
|
|
||||||
#define VTMR_NUM_TIMERS 4
|
|
||||||
#define VTMR_FREQ_HZ 4
|
|
||||||
|
|
||||||
// Number of resources (0 if not available/not implemented)
|
|
||||||
#define NUM_PIO 2
|
|
||||||
#define NUM_SPI 0
|
|
||||||
#define NUM_UART 2
|
|
||||||
#if VTMR_NUM_TIMERS > 0
|
|
||||||
#define NUM_TIMER 3
|
|
||||||
#else
|
|
||||||
#define NUM_TIMER 2
|
|
||||||
#endif
|
|
||||||
#define NUM_PWM 4
|
|
||||||
#define NUM_ADC 0
|
|
||||||
#define NUM_CAN 0
|
|
||||||
|
|
||||||
// RPC boot options
|
|
||||||
#define RPC_UART_ID CON_UART_ID
|
|
||||||
#define RPC_UART_SPEED CON_UART_SPEED
|
|
||||||
|
|
||||||
// Enable RX buffering on UART
|
|
||||||
#define BUF_ENABLE_UART
|
|
||||||
#define CON_BUF_SIZE BUF_SIZE_128
|
|
||||||
|
|
||||||
// CPU frequency (needed by the CPU module and MMCFS code, 0 if not used)
|
|
||||||
#define CPU_FREQUENCY BOARD_MCK
|
|
||||||
|
|
||||||
// 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 31
|
|
||||||
|
|
||||||
// Allocator data: define your free memory zones here in two arrays
|
|
||||||
// (start address and end address)
|
|
||||||
#define SRAM_ORIGIN 0x200000
|
|
||||||
#ifdef at91sam7x256
|
|
||||||
#define SRAM_SIZE 0x10000
|
|
||||||
#else
|
|
||||||
#define SRAM_SIZE 0x20000
|
|
||||||
#endif
|
|
||||||
#define MEM_START_ADDRESS { ( void* )end }
|
|
||||||
#define MEM_END_ADDRESS { ( void* )( SRAM_ORIGIN + SRAM_SIZE - STACK_SIZE_TOTAL - 1 ) }
|
|
||||||
|
|
||||||
/*
|
|
||||||
#define RFS_BUFFER_SIZE BUF_SIZE_512
|
|
||||||
#define RFS_UART_ID ( SERMUX_SERVICE_ID_FIRST )
|
|
||||||
#define RFS_TIMEOUT 100000
|
|
||||||
#define RFS_UART_SPEED 115200
|
|
||||||
|
|
||||||
#define SERMUX_PHYS_ID 0
|
|
||||||
#define SERMUX_PHYS_SPEED 115200
|
|
||||||
#define SERMUX_NUM_VUART 2
|
|
||||||
#define SERMUX_BUFFER_SIZES { RFS_BUFFER_SIZE, CON_BUF_SIZE }
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Interrupt list
|
|
||||||
#define INT_UART_RX ELUA_INT_FIRST_ID
|
|
||||||
#define INT_ELUA_LAST INT_UART_RX
|
|
||||||
|
|
||||||
#define PLATFORM_CPU_CONSTANTS\
|
|
||||||
_C( INT_UART_RX )
|
|
||||||
|
|
||||||
#endif // #ifndef __PLATFORM_CONF_H__
|
|
14
src/platform/at91sam7x/platform_generic.h
Normal file
14
src/platform/at91sam7x/platform_generic.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// Generic platform configuration file
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_GENERIC_H__
|
||||||
|
#define __PLATFORM_GENERIC_H__
|
||||||
|
|
||||||
|
#define PLATFORM_HAS_SYSTIMER
|
||||||
|
|
||||||
|
#if VTMR_NUM_TIMERS > 0
|
||||||
|
#undef NUM_TIMER
|
||||||
|
#define NUM_TIMER 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // #ifndef __PLATFORM_GENERIC_H__
|
||||||
|
|
12
src/platform/at91sam7x/platform_ints.h
Normal file
12
src/platform/at91sam7x/platform_ints.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// List of interrupts for this platform
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_INTS_H__
|
||||||
|
#define __PLATFORM_INTS_H__
|
||||||
|
|
||||||
|
#include "elua_int.h"
|
||||||
|
|
||||||
|
#define INT_UART_RX ELUA_INT_FIRST_ID
|
||||||
|
#define INT_ELUA_LAST INT_UART_RX
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user