JasonHu 4 лет назад
Родитель
Сommit
be838bf2fc
3 измененных файлов с 24 добавлено и 9 удалено
  1. 2 1
      bsp/x86/drivers/board.c
  2. 3 3
      bsp/x86/drivers/drv_uart.c
  3. 19 5
      bsp/x86/rtconfig.py

+ 2 - 1
bsp/x86/drivers/board.c

@@ -67,7 +67,8 @@ void rt_hw_board_init(void)
     init_page_region.start = (size_t)HW_PAGE_START;
     init_page_region.start = (size_t)HW_PAGE_START;
     init_page_region.end = page_region_init();
     init_page_region.end = page_region_init();
     /* init no mapped area in kernel table, must in kernel space */
     /* init no mapped area in kernel table, must in kernel space */
-    RT_ASSERT(!rt_hw_mmu_map_init(&mmu_info, (void *)HW_KERNEL_DELAY_MAP_START, HW_KERNEL_DELAY_MAP_SIZE, (rt_size_t *)g_mmu_table, 0))
+    RT_ASSERT(!rt_hw_mmu_map_init(&mmu_info, (void *)HW_KERNEL_DELAY_MAP_START, 
+              HW_KERNEL_DELAY_MAP_SIZE, (rt_size_t *)g_mmu_table, 0))
 
 
     rt_page_init(init_page_region);
     rt_page_init(init_page_region);
     /* map kernel space, then can read/write this area directly. */
     /* map kernel space, then can read/write this area directly. */

+ 3 - 3
bsp/x86/drivers/drv_uart.c

@@ -41,8 +41,8 @@ struct hw_uart_device
 #define SERIAL0_IRQ    4
 #define SERIAL0_IRQ    4
 #define SERIAL1_IRQ    3
 #define SERIAL1_IRQ    3
 
 
-#define MAX_BAUD_VALUE  11520
-#define DEFAULT_BAUD_VALUE  11520
+#define MAX_BAUD_VALUE  115200
+#define DEFAULT_BAUD_VALUE  115200
 #define DEFAULT_DIVISOR_VALUE (MAX_BAUD_VALUE / DEFAULT_BAUD_VALUE)
 #define DEFAULT_DIVISOR_VALUE (MAX_BAUD_VALUE / DEFAULT_BAUD_VALUE)
 
 
 enum uart_fifo_control_register_bits
 enum uart_fifo_control_register_bits
@@ -281,7 +281,7 @@ static void do_uart_init(char *name, struct hw_uart_device *uart, struct rt_seri
 
 
     /* register device */
     /* register device */
     rt_hw_serial_register(serial, name,
     rt_hw_serial_register(serial, name,
-                          RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
+                          RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
                           uart);
                           uart);
     rt_hw_interrupt_install(uart->irqno, rt_hw_uart_isr, serial, name);
     rt_hw_interrupt_install(uart->irqno, rt_hw_uart_isr, serial, name);
     rt_hw_interrupt_umask(uart->irqno);
     rt_hw_interrupt_umask(uart->irqno);

+ 19 - 5
bsp/x86/rtconfig.py

@@ -31,23 +31,37 @@ if os.getenv('RTT_EXEC_PATH'):
 	EXEC_PATH = os.getenv('RTT_EXEC_PATH')
 	EXEC_PATH = os.getenv('RTT_EXEC_PATH')
 
 
 BUILD = 'debug'
 BUILD = 'debug'
+LIBC_MODE = 'release' # 'debug' or 'release', if debug, use libc in components, or not use libc with toolchain
 
 
 if PLATFORM == 'gcc':
 if PLATFORM == 'gcc':
     # toolchains
     # toolchains
     PREFIX = 'i386-unknown-linux-musl-'
     PREFIX = 'i386-unknown-linux-musl-'
-    CC = PREFIX + 'gcc -fno-builtin -fno-stack-protector -nostdinc -nostdlib'
-    AS = PREFIX + 'gcc -nostdinc -nostdlib'
+ 
+    CC = PREFIX + 'gcc'
+    AS = PREFIX + 'gcc'
     AR = PREFIX + 'ar'
     AR = PREFIX + 'ar'
-    LINK = PREFIX + 'ld'
+    LINK = PREFIX + 'gcc'
     TARGET_EXT = 'elf'
     TARGET_EXT = 'elf'
     SIZE = PREFIX + 'size'
     SIZE = PREFIX + 'size'
     OBJDUMP = PREFIX + 'objdump'
     OBJDUMP = PREFIX + 'objdump'
     OBJCPY = PREFIX + 'objcopy'
     OBJCPY = PREFIX + 'objcopy'
 
 
     DEVICE = ''
     DEVICE = ''
-    CFLAGS = DEVICE + ' -Wall'
+
+    if LIBC_MODE == 'debug':
+        EXT_CFLAGS = ' -nostdinc -nostdlib -fno-builtin -fno-stack-protector'
+    else:
+        EXT_CFLAGS = ''
+
+    CFLAGS = DEVICE + ' -Wall'  + EXT_CFLAGS
     AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
     AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
-    LFLAGS = DEVICE + ' -Map rtthread-i386.map -nostdlib -n -T link.lds'
+
+    if LIBC_MODE == 'debug':
+        EXT_LFLAGS = ' -nostdlib'
+    else:
+        EXT_LFLAGS = ''
+        
+    LFLAGS = DEVICE + ' -static -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref -n -T link.lds' + EXT_LFLAGS
 
 
     CPATH = ''
     CPATH = ''
     LPATH = ''
     LPATH = ''