Kaynağa Gözat

In stm32fx's stm32_rom.ld, add symbol - '_stext' to support lua a. Update lua's README.TXT

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2410 bbd45198-f89e-11dd-88c7-29a3b14d5316
xiongyihui3@gmail.com 12 yıl önce
ebeveyn
işleme
d48ef70ecd

+ 1 - 0
bsp/stm32f107/stm32_rom.ld

@@ -17,6 +17,7 @@ SECTIONS
     .text :
     {
         . = ALIGN(4);
+        _stext = .;
         KEEP(*(.isr_vector))            /* Startup code */
         . = ALIGN(4);
         *(.text)                        /* remaining code */

+ 1 - 0
bsp/stm32f10x/stm32_rom.ld

@@ -17,6 +17,7 @@ SECTIONS
     .text :
     {
         . = ALIGN(4);
+        _stext = .;
         KEEP(*(.isr_vector))            /* Startup code */
         . = ALIGN(4);
         *(.text)                        /* remaining code */

+ 1 - 0
bsp/stm32f20x/stm32_rom.ld

@@ -17,6 +17,7 @@ SECTIONS
     .text :
     {
         . = ALIGN(4);
+        _stext = .;
         KEEP(*(.isr_vector))            /* Startup code */
         . = ALIGN(4);
         *(.text)                        /* remaining code */

+ 1 - 0
bsp/stm32f40x/stm32_rom.ld

@@ -17,6 +17,7 @@ SECTIONS
     .text :
     {
         . = ALIGN(4);
+        _stext = .;
         KEEP(*(.isr_vector))            /* Startup code */
         . = ALIGN(4);
         *(.text)                        /* remaining code */

+ 5 - 4
components/external/lua/README.TXT

@@ -2,7 +2,7 @@
 
 ## 简介
 RT-Thread中的Lua修改自[eLua](http://www.eluaproject.net/)的Lua-5.1.4版本。
-Lua依赖于Neblib库
+采用gcc工具链时,Lua依赖于newlib库,其它工具链暂时还不支持
 启动lua的RAM占用情况
     - 标准的lua        17.1904296875 KB
     - 优化的lua        5.01953125 KB
@@ -24,13 +24,14 @@ Lua依赖于Neblib库。
     3.更多的配置项可以在luaconf.h中找到
 
 ## 开发相关
+    - 采用gcc工具链时,依赖于newlib,需在rtconfig.h中定义RT_USING_NEWLIB
     - 开启编译器对C99的支持,如MDK中,在C/C++选项的Misc Controls输入框中添加--c99
-    - 开启内存优化时:需要在链接脚本中定义_stext和_etext,.ordata*放在两者之间。
+    - 需要在链接脚本中定义_stext和_etext,.ordata*放在两者之间。
       用于判断数据是read-only和writable。MDK中如何实现??
-    - 添加新的模块,参见larduinolib.c
+    - 添加新的模块,参见lexample.c
     
 ## 目录说明
     - lua:从eLua获得Lua-5.1.4版本代码
-    - exlibs:external libraries,外部库代码,如Arduino
+    - exlibs:external libraries,外部库代码,如example
     - applications:Lua应用代码,如finsh中lua()
     - test:测试代码

+ 6 - 7
components/libc/newlib/syscalls.c

@@ -197,7 +197,6 @@ _wait_r(struct _reent *ptr, int *status)
 _ssize_t
 _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes)
 {
-#ifndef RT_USING_DFS
 	if (fd < 3)
 	{
 		rt_device_t console_device;
@@ -207,13 +206,13 @@ _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes)
 		if (console_device != 0) rt_device_write(console_device, 0, buf, nbytes);
 		return nbytes;
 	}
-	return 0;
-#else
-	_ssize_t rc;
+	else
+	{
+	    _ssize_t rc;
 
-	rc = write(fd, buf, nbytes);
-	return rc;
-#endif
+	    rc = write(fd, buf, nbytes);
+	    return rc;
+	}
 }
 #endif