diff --git a/bsp/realview-a8/SConstruct b/bsp/realview-a8/SConstruct index e67d72291fa3adcefaaff32c6719c809e5f322e8..6d57bc402544e138913a82db403ab35ce6bbc648 100644 --- a/bsp/realview-a8/SConstruct +++ b/bsp/realview-a8/SConstruct @@ -31,8 +31,12 @@ if GetDepend('RT_USING_VMM'): ldfile = rtconfig.LINK_SCRIPT)) != 0: print 'failed to generate linker script %s' % rtconfig.LINK_SCRIPT sys.exit(255) -# if the linker script changed, relink the target -Depends(TARGET, rtconfig.LINK_SCRIPT) + # if the linker script changed, relink the target + Depends(TARGET, rtconfig.LINK_SCRIPT) +else: + # we should use none-vmm link script + link_flags = str(env['LINKFLAGS']) + env['LINKFLAGS'] = link_flags.replace('_vmm.lds', '.lds') # make a building DoBuilding(TARGET, objs) diff --git a/bsp/realview-a8/applications/application.c b/bsp/realview-a8/applications/application.c index e65878bce576fd4a299ca0fb2e2578466a5c7660..1b7cb790a308e220b4c6f5847bd761252785f868 100644 --- a/bsp/realview-a8/applications/application.c +++ b/bsp/realview-a8/applications/application.c @@ -15,32 +15,18 @@ #include #include -#include - -void *test_task(void *parameter) +void init_thread(void* parameter) { - int count = 0; - - while (1) - { - rt_thread_delay(RT_TICK_PER_SECOND); - rt_kprintf("count = %d\n", count ++); - } - - return RT_NULL; + rt_components_init(); } int rt_application_init() { - // pthread_t tid; - - /* do component initialization */ - rt_components_init(); -#ifdef RT_USING_NEWLIB - libc_system_init(RT_CONSOLE_DEVICE_NAME); -#endif + rt_thread_t tid; - // pthread_create(&tid, RT_NULL, test_task, RT_NULL); + tid = rt_thread_create("init", init_thread, RT_NULL, + 1024, RT_THREAD_PRIORITY_MAX/3, 10); + if (tid != RT_NULL) rt_thread_startup(tid); return 0; } diff --git a/bsp/realview-a8/drivers/board.c b/bsp/realview-a8/drivers/board.c index 8312a4e85f0325a36bb9ca64f2972c54c62efa69..fd64075456cbbf8a38cf38cab7695854c39c27e4 100644 --- a/bsp/realview-a8/drivers/board.c +++ b/bsp/realview-a8/drivers/board.c @@ -38,11 +38,11 @@ #define SYS_CTRL __REG32(REALVIEW_SCTL_BASE) #ifdef RT_USING_VMM - #include - static rt_uint32_t timer_hw_base = 0; - #define TIMER_HW_BASE (timer_hw_base) +#include +static rt_uint32_t timer_hw_base = 0; +#define TIMER_HW_BASE (timer_hw_base) #else - #define TIMER_HW_BASE REALVIEW_TIMER2_3_BASE +#define TIMER_HW_BASE REALVIEW_TIMER2_3_BASE #endif void rt_hw_timer_ack(void) diff --git a/bsp/realview-a8/drivers/serial.c b/bsp/realview-a8/drivers/serial.c index 011d10fb99bfe6765cb3226e7b15026b830ad0e5..7df953a282eb5b29c20d63815c1c6cb543e50cc3 100644 --- a/bsp/realview-a8/drivers/serial.c +++ b/bsp/realview-a8/drivers/serial.c @@ -32,7 +32,7 @@ #include "serial.h" #ifdef RT_USING_VMM - #include +#include #endif struct hw_uart_device @@ -165,8 +165,8 @@ int rt_hw_uart_init(void) config.parity = PARITY_NONE; config.stop_bits = STOP_BITS_1; config.invert = NRZ_NORMAL; - config.bufsz = RT_SERIAL_RB_BUFSZ; - + config.bufsz = RT_SERIAL_RB_BUFSZ; + #ifdef RT_USING_UART0 uart = &_uart0_device; #ifdef RT_USING_VMM @@ -194,7 +194,7 @@ int rt_hw_uart_init(void) /* register UART1 device */ rt_hw_serial_register(&_serial1, "uart1", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, uart); + RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, uart); /* enable Rx and Tx of UART */ UART_CR(uart->hw_base) = (1 << 0) | (1 << 8) | (1 << 9); #endif diff --git a/bsp/realview-a8/rtconfig.h b/bsp/realview-a8/rtconfig.h index b32ae454cea52c744660594a7fd8db9384bac4f7..9ef916998e8e02375d133818035cc44491a2ff29 100644 --- a/bsp/realview-a8/rtconfig.h +++ b/bsp/realview-a8/rtconfig.h @@ -107,8 +107,8 @@ // //
-// -#define RT_USING_NEWLIB +// +#define RT_USING_LIBC // #define RT_USING_PTHREADS //
@@ -147,7 +147,7 @@ #define RT_USING_LOGTRACE //
-#define RT_USING_VMM +// #define RT_USING_VMM //
#endif diff --git a/bsp/realview-a8/rtconfig.py b/bsp/realview-a8/rtconfig.py index 85f36831b3960a15f45b2d2d27f009a2b8646d00..f921c6821743e209f424c4718428c79f943772ab 100644 --- a/bsp/realview-a8/rtconfig.py +++ b/bsp/realview-a8/rtconfig.py @@ -21,8 +21,6 @@ if os.getenv('RTT_EXEC_PATH'): EXEC_PATH = os.getenv('RTT_EXEC_PATH') BUILD = 'debug' -VMM = True -#VMM = False if PLATFORM == 'gcc': # toolchains @@ -40,10 +38,7 @@ if PLATFORM == 'gcc': DEVICE = ' -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3-d16 -ftree-vectorize -ffast-math -mfloat-abi=softfp' CFLAGS = DEVICE + ' -Wall' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -D__ASSEMBLY__' - if VMM: - LINK_SCRIPT = 'realview_vmm.lds' - else: - LINK_SCRIPT = 'realview.lds' + LINK_SCRIPT = 'realview_vmm.lds' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=realview.map,-cref,-u,system_vectors'+\ ' -T %s' % LINK_SCRIPT