Browse Source

Merge pull request #134 from prife/sim-fix

simulator: update to support simulator for linux
Bernard Xiong 11 years ago
parent
commit
e28c8963e6

+ 1 - 0
bsp/simulator/SConstruct

@@ -75,6 +75,7 @@ elif rtconfig.PLATFORM == 'mingw':
     env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
 else:
     TARGET = 'rtthread'
+    env['CC']=rtconfig.CC
     env.Append(CCFLAGS=rtconfig.CFLAGS)
     env.Append(LINKFLAGS=rtconfig.LFLAGS)
     env.Append(LIBS=['m'])

+ 4 - 0
bsp/simulator/drivers/SConscript

@@ -1,3 +1,4 @@
+import sys
 from building import *
 
 cwd = GetCurrentDir()
@@ -16,6 +17,9 @@ if GetDepend('RT_USING_DFS_WINSHAREDIR') == False:
     SrcRemove(src, 'dfs_win32.c')
 if GetDepend('RT_USING_MODULE') == False:
     SrcRemove(src, ['module_win32.c'])
+if sys.platform[0:5]=="linux": #check whether under linux
+    SrcRemove(src, ['module_win32.c', 'dfs_win32.c'])
+
 CPPPATH = [cwd]
 
 group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)

+ 2 - 0
bsp/simulator/drivers/usart_sim.c

@@ -81,6 +81,8 @@ static pthread_t OSKey_Thread;
 void rt_hw_usart_init(void)
 {
     int res;
+
+    rt_hw_serial_init(&serial1, RT_CONSOLE_DEVICE_NAME);
     res = pthread_create(&OSKey_Thread, NULL, &ThreadforKeyGet, NULL);
     if (res)
     {

+ 6 - 0
bsp/simulator/gcc.ld

@@ -79,6 +79,12 @@ SECTIONS
       __vsymtab_end = .;
   }
   . = ALIGN(4);
+  rti_fn : {
+      __rt_init_start = .;
+      KEEP(*(SORT(.rti_fn*)))
+      __rt_init_end = .;
+  }
+  . = ALIGN(4);
   /* setction information for finsh shell end */
 
   .eh_frame_hdr : { *(.eh_frame_hdr) }