提交 f6c8e391 编写于 作者: B Bernard Xiong

Merge pull request #309 from BernardXiong/stable-v1.2.x

prepare RT-Thread 1.2.2 release
...@@ -426,7 +426,7 @@ int rt_hw_serial_init(void) ...@@ -426,7 +426,7 @@ int rt_hw_serial_init(void)
config.stop_bits = STOP_BITS_1; config.stop_bits = STOP_BITS_1;
config.invert = NRZ_NORMAL; config.invert = NRZ_NORMAL;
serial3.ops = &am33xx_uart_ops; serial3.ops = &am33xx_uart_ops;
serial3.int_rx = &uart_3_int_rx; serial3.int_rx = &uart3_int_rx;
serial3.config = config; serial3.config = config;
/* enable RX interrupt */ /* enable RX interrupt */
UART_IER_REG(uart3.base) = 0x01; UART_IER_REG(uart3.base) = 0x01;
...@@ -470,7 +470,7 @@ int rt_hw_serial_init(void) ...@@ -470,7 +470,7 @@ int rt_hw_serial_init(void)
config.parity = PARITY_NONE; config.parity = PARITY_NONE;
config.stop_bits = STOP_BITS_1; config.stop_bits = STOP_BITS_1;
config.invert = NRZ_NORMAL; config.invert = NRZ_NORMAL;
serial5.ops = &am33xx_uart_ops; serial5.ops = &am33xx_uart_ops;
serial5.int_rx = &uart5_int_rx; serial5.int_rx = &uart5_int_rx;
serial5.config = config; serial5.config = config;
......
...@@ -165,8 +165,8 @@ static void GPIO_Configuration(void) ...@@ -165,8 +165,8 @@ static void GPIO_Configuration(void)
GPIO_Init(UART3_GPIO, &GPIO_InitStructure); GPIO_Init(UART3_GPIO, &GPIO_InitStructure);
/* Connect alternate function */ /* Connect alternate function */
GPIO_PinAFConfig(UART2_GPIO, UART3_TX_PIN_SOURCE, GPIO_AF_USART3); GPIO_PinAFConfig(UART3_GPIO, UART3_TX_PIN_SOURCE, GPIO_AF_USART3);
GPIO_PinAFConfig(UART2_GPIO, UART3_RX_PIN_SOURCE, GPIO_AF_USART3); GPIO_PinAFConfig(UART3_GPIO, UART3_RX_PIN_SOURCE, GPIO_AF_USART3);
#endif #endif
} }
......
...@@ -629,7 +629,15 @@ static void copyfile(const char *src, const char *dst) ...@@ -629,7 +629,15 @@ static void copyfile(const char *src, const char *dst)
read_bytes = dfs_file_read(&src_fd, block_ptr, BUF_SZ); read_bytes = dfs_file_read(&src_fd, block_ptr, BUF_SZ);
if (read_bytes > 0) if (read_bytes > 0)
{ {
dfs_file_write(&fd, block_ptr, read_bytes); int length;
length = dfs_file_write(&fd, block_ptr, read_bytes);
if (length != read_bytes)
{
/* write failed. */
rt_kprintf("Write file data failed, errno=%d\n", length);
break;
}
} }
} while (read_bytes > 0); } while (read_bytes > 0);
......
...@@ -3,6 +3,14 @@ ...@@ -3,6 +3,14 @@
#include <sys/time.h> #include <sys/time.h>
#include <rtthread.h> #include <rtthread.h>
#ifdef RT_USING_DFS
#include <dfs_posix.h>
#endif
#ifdef RT_USING_PTHREADS
#include <pthread.h>
#endif
/* Reentrant versions of system calls. */ /* Reentrant versions of system calls. */
int int
......
...@@ -98,7 +98,11 @@ int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) ...@@ -98,7 +98,11 @@ int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
rt_snprintf(cond_name, sizeof(cond_name), "cond%02d", cond_num++); rt_snprintf(cond_name, sizeof(cond_name), "cond%02d", cond_num++);
cond->attr = *attr; if (attr == RT_NULL) /* use default value */
cond->attr = PTHREAD_PROCESS_PRIVATE;
else
cond->attr = *attr;
result = rt_sem_init(&cond->sem, cond_name, 0, RT_IPC_FLAG_FIFO); result = rt_sem_init(&cond->sem, cond_name, 0, RT_IPC_FLAG_FIFO);
if (result != RT_EOK) if (result != RT_EOK)
return EINVAL; return EINVAL;
......
...@@ -79,8 +79,8 @@ _reswitch: ...@@ -79,8 +79,8 @@ _reswitch:
STR R1, [R0] STR R1, [R0]
BX LR BX LR
/* R0 --> swith from thread stack /* R0 --> switch from thread stack
* R1 --> swith to thread stack * R1 --> switch to thread stack
* psr, pc, LR, R12, R3, R2, R1, R0 are pushed into [from] stack * psr, pc, LR, R12, R3, R2, R1, R0 are pushed into [from] stack
*/ */
.global PendSV_Handler .global PendSV_Handler
...@@ -103,7 +103,7 @@ PendSV_Handler: ...@@ -103,7 +103,7 @@ PendSV_Handler:
LDR R0, =rt_interrupt_from_thread LDR R0, =rt_interrupt_from_thread
LDR R1, [R0] LDR R1, [R0]
CMP R1, #0x00 CMP R1, #0x00
BEQ swtich_to_thread /* skip register save at the first time */ BEQ switch_to_thread /* skip register save at the first time */
MRS R1, PSP /* get from thread stack pointer */ MRS R1, PSP /* get from thread stack pointer */
...@@ -118,7 +118,7 @@ PendSV_Handler: ...@@ -118,7 +118,7 @@ PendSV_Handler:
MOV R6, R10 MOV R6, R10
MOV R7, R11 MOV R7, R11
STMIA R1!, {R4 - R7} /* push thread {R8 - R11} high register to thread stack */ STMIA R1!, {R4 - R7} /* push thread {R8 - R11} high register to thread stack */
swtich_to_thread: switch_to_thread:
LDR R1, =rt_interrupt_to_thread LDR R1, =rt_interrupt_to_thread
LDR R1, [R1] LDR R1, [R1]
LDR R1, [R1] /* load thread stack pointer */ LDR R1, [R1] /* load thread stack pointer */
......
...@@ -81,8 +81,8 @@ _reswitch ...@@ -81,8 +81,8 @@ _reswitch
STR r1, [r0] STR r1, [r0]
BX LR BX LR
; r0 --> swith from thread stack ; r0 --> switch from thread stack
; r1 --> swith to thread stack ; r1 --> switch to thread stack
; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack ; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
EXPORT PendSV_Handler EXPORT PendSV_Handler
PendSV_Handler: PendSV_Handler:
...@@ -104,7 +104,7 @@ PendSV_Handler: ...@@ -104,7 +104,7 @@ PendSV_Handler:
LDR r0, =rt_interrupt_from_thread LDR r0, =rt_interrupt_from_thread
LDR r1, [r0] LDR r1, [r0]
CMP r1, #0x00 CMP r1, #0x00
BEQ swtich_to_thread ; skip register save at the first time BEQ switch_to_thread ; skip register save at the first time
MRS r1, psp ; get from thread stack pointer MRS r1, psp ; get from thread stack pointer
...@@ -120,7 +120,7 @@ PendSV_Handler: ...@@ -120,7 +120,7 @@ PendSV_Handler:
MOV r7, r11 MOV r7, r11
STMIA r1!, {r4 - r7} ; push thread {r8 - r11} high register to thread stack STMIA r1!, {r4 - r7} ; push thread {r8 - r11} high register to thread stack
swtich_to_thread switch_to_thread
LDR r1, =rt_interrupt_to_thread LDR r1, =rt_interrupt_to_thread
LDR r1, [r1] LDR r1, [r1]
LDR r1, [r1] ; load thread stack pointer LDR r1, [r1] ; load thread stack pointer
......
...@@ -85,8 +85,8 @@ _reswitch ...@@ -85,8 +85,8 @@ _reswitch
BX LR BX LR
ENDP ENDP
; r0 --> swith from thread stack ; r0 --> switch from thread stack
; r1 --> swith to thread stack ; r1 --> switch to thread stack
; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack ; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
PendSV_Handler PROC PendSV_Handler PROC
EXPORT PendSV_Handler EXPORT PendSV_Handler
...@@ -108,7 +108,7 @@ PendSV_Handler PROC ...@@ -108,7 +108,7 @@ PendSV_Handler PROC
LDR r0, =rt_interrupt_from_thread LDR r0, =rt_interrupt_from_thread
LDR r1, [r0] LDR r1, [r0]
CMP r1, #0x00 CMP r1, #0x00
BEQ swtich_to_thread ; skip register save at the first time BEQ switch_to_thread ; skip register save at the first time
MRS r1, psp ; get from thread stack pointer MRS r1, psp ; get from thread stack pointer
...@@ -124,7 +124,7 @@ PendSV_Handler PROC ...@@ -124,7 +124,7 @@ PendSV_Handler PROC
MOV r7, r11 MOV r7, r11
STMIA r1!, {r4 - r7} ; push thread {r8 - r11} high register to thread stack STMIA r1!, {r4 - r7} ; push thread {r8 - r11} high register to thread stack
swtich_to_thread switch_to_thread
LDR r1, =rt_interrupt_to_thread LDR r1, =rt_interrupt_to_thread
LDR r1, [r1] LDR r1, [r1]
LDR r1, [r1] ; load thread stack pointer LDR r1, [r1] ; load thread stack pointer
......
...@@ -80,8 +80,8 @@ _reswitch: ...@@ -80,8 +80,8 @@ _reswitch:
STR R1, [R0] STR R1, [R0]
BX LR BX LR
/* R0 --> swith from thread stack /* R0 --> switch from thread stack
* R1 --> swith to thread stack * R1 --> switch to thread stack
* psr, pc, LR, R12, R3, R2, R1, R0 are pushed into [from] stack * psr, pc, LR, R12, R3, R2, R1, R0 are pushed into [from] stack
*/ */
.global PendSV_Handler .global PendSV_Handler
...@@ -102,14 +102,14 @@ PendSV_Handler: ...@@ -102,14 +102,14 @@ PendSV_Handler:
LDR R0, =rt_interrupt_from_thread LDR R0, =rt_interrupt_from_thread
LDR R1, [R0] LDR R1, [R0]
CBZ R1, swtich_to_thread /* skip register save at the first time */ CBZ R1, switch_to_thread /* skip register save at the first time */
MRS R1, PSP /* get from thread stack pointer */ MRS R1, PSP /* get from thread stack pointer */
STMFD R1!, {R4 - R11} /* push R4 - R11 register */ STMFD R1!, {R4 - R11} /* push R4 - R11 register */
LDR R0, [R0] LDR R0, [R0]
STR R1, [R0] /* update from thread stack pointer */ STR R1, [R0] /* update from thread stack pointer */
swtich_to_thread: switch_to_thread:
LDR R1, =rt_interrupt_to_thread LDR R1, =rt_interrupt_to_thread
LDR R1, [R1] LDR R1, [R1]
LDR R1, [R1] /* load thread stack pointer */ LDR R1, [R1] /* load thread stack pointer */
......
...@@ -81,8 +81,8 @@ _reswitch ...@@ -81,8 +81,8 @@ _reswitch
STR r1, [r0] STR r1, [r0]
BX LR BX LR
; r0 --> swith from thread stack ; r0 --> switch from thread stack
; r1 --> swith to thread stack ; r1 --> switch to thread stack
; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack ; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
EXPORT PendSV_Handler EXPORT PendSV_Handler
PendSV_Handler: PendSV_Handler:
...@@ -102,14 +102,14 @@ PendSV_Handler: ...@@ -102,14 +102,14 @@ PendSV_Handler:
LDR r0, =rt_interrupt_from_thread LDR r0, =rt_interrupt_from_thread
LDR r1, [r0] LDR r1, [r0]
CBZ r1, swtich_to_thread ; skip register save at the first time CBZ r1, switch_to_thread ; skip register save at the first time
MRS r1, psp ; get from thread stack pointer MRS r1, psp ; get from thread stack pointer
STMFD r1!, {r4 - r11} ; push r4 - r11 register STMFD r1!, {r4 - r11} ; push r4 - r11 register
LDR r0, [r0] LDR r0, [r0]
STR r1, [r0] ; update from thread stack pointer STR r1, [r0] ; update from thread stack pointer
swtich_to_thread switch_to_thread
LDR r1, =rt_interrupt_to_thread LDR r1, =rt_interrupt_to_thread
LDR r1, [r1] LDR r1, [r1]
LDR r1, [r1] ; load thread stack pointer LDR r1, [r1] ; load thread stack pointer
......
...@@ -84,8 +84,8 @@ _reswitch ...@@ -84,8 +84,8 @@ _reswitch
BX LR BX LR
ENDP ENDP
; r0 --> swith from thread stack ; r0 --> switch from thread stack
; r1 --> swith to thread stack ; r1 --> switch to thread stack
; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack ; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
PendSV_Handler PROC PendSV_Handler PROC
EXPORT PendSV_Handler EXPORT PendSV_Handler
...@@ -105,14 +105,14 @@ PendSV_Handler PROC ...@@ -105,14 +105,14 @@ PendSV_Handler PROC
LDR r0, =rt_interrupt_from_thread LDR r0, =rt_interrupt_from_thread
LDR r1, [r0] LDR r1, [r0]
CBZ r1, swtich_to_thread ; skip register save at the first time CBZ r1, switch_to_thread ; skip register save at the first time
MRS r1, psp ; get from thread stack pointer MRS r1, psp ; get from thread stack pointer
STMFD r1!, {r4 - r11} ; push r4 - r11 register STMFD r1!, {r4 - r11} ; push r4 - r11 register
LDR r0, [r0] LDR r0, [r0]
STR r1, [r0] ; update from thread stack pointer STR r1, [r0] ; update from thread stack pointer
swtich_to_thread switch_to_thread
LDR r1, =rt_interrupt_to_thread LDR r1, =rt_interrupt_to_thread
LDR r1, [r1] LDR r1, [r1]
LDR r1, [r1] ; load thread stack pointer LDR r1, [r1] ; load thread stack pointer
......
...@@ -82,8 +82,8 @@ _reswitch: ...@@ -82,8 +82,8 @@ _reswitch:
STR r1, [r0] STR r1, [r0]
BX LR BX LR
/* r0 --> swith from thread stack /* r0 --> switch from thread stack
* r1 --> swith to thread stack * r1 --> switch to thread stack
* psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack * psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
*/ */
.global PendSV_Handler .global PendSV_Handler
...@@ -104,7 +104,7 @@ PendSV_Handler: ...@@ -104,7 +104,7 @@ PendSV_Handler:
LDR r0, =rt_interrupt_from_thread LDR r0, =rt_interrupt_from_thread
LDR r1, [r0] LDR r1, [r0]
CBZ r1, swtich_to_thread /* skip register save at the first time */ CBZ r1, switch_to_thread /* skip register save at the first time */
MRS r1, psp /* get from thread stack pointer */ MRS r1, psp /* get from thread stack pointer */
...@@ -127,7 +127,7 @@ PendSV_Handler: ...@@ -127,7 +127,7 @@ PendSV_Handler:
LDR r0, [r0] LDR r0, [r0]
STR r1, [r0] /* update from thread stack pointer */ STR r1, [r0] /* update from thread stack pointer */
swtich_to_thread: switch_to_thread:
LDR r1, =rt_interrupt_to_thread LDR r1, =rt_interrupt_to_thread
LDR r1, [r1] LDR r1, [r1]
LDR r1, [r1] /* load thread stack pointer */ LDR r1, [r1] /* load thread stack pointer */
......
...@@ -82,8 +82,8 @@ _reswitch ...@@ -82,8 +82,8 @@ _reswitch
STR r1, [r0] STR r1, [r0]
BX LR BX LR
; r0 --> swith from thread stack ; r0 --> switch from thread stack
; r1 --> swith to thread stack ; r1 --> switch to thread stack
; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack ; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
EXPORT PendSV_Handler EXPORT PendSV_Handler
PendSV_Handler: PendSV_Handler:
...@@ -103,7 +103,7 @@ PendSV_Handler: ...@@ -103,7 +103,7 @@ PendSV_Handler:
LDR r0, =rt_interrupt_from_thread LDR r0, =rt_interrupt_from_thread
LDR r1, [r0] LDR r1, [r0]
CBZ r1, swtich_to_thread ; skip register save at the first time CBZ r1, switch_to_thread ; skip register save at the first time
MRS r1, psp ; get from thread stack pointer MRS r1, psp ; get from thread stack pointer
...@@ -130,7 +130,7 @@ push_flag ...@@ -130,7 +130,7 @@ push_flag
LDR r0, [r0] LDR r0, [r0]
STR r1, [r0] ; update from thread stack pointer STR r1, [r0] ; update from thread stack pointer
swtich_to_thread switch_to_thread
LDR r1, =rt_interrupt_to_thread LDR r1, =rt_interrupt_to_thread
LDR r1, [r1] LDR r1, [r1]
LDR r1, [r1] ; load thread stack pointer LDR r1, [r1] ; load thread stack pointer
......
...@@ -85,8 +85,8 @@ _reswitch ...@@ -85,8 +85,8 @@ _reswitch
BX LR BX LR
ENDP ENDP
; r0 --> swith from thread stack ; r0 --> switch from thread stack
; r1 --> swith to thread stack ; r1 --> switch to thread stack
; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack ; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
PendSV_Handler PROC PendSV_Handler PROC
EXPORT PendSV_Handler EXPORT PendSV_Handler
...@@ -106,7 +106,7 @@ PendSV_Handler PROC ...@@ -106,7 +106,7 @@ PendSV_Handler PROC
LDR r0, =rt_interrupt_from_thread LDR r0, =rt_interrupt_from_thread
LDR r1, [r0] LDR r1, [r0]
CBZ r1, swtich_to_thread ; skip register save at the first time CBZ r1, switch_to_thread ; skip register save at the first time
MRS r1, psp ; get from thread stack pointer MRS r1, psp ; get from thread stack pointer
...@@ -129,7 +129,7 @@ PendSV_Handler PROC ...@@ -129,7 +129,7 @@ PendSV_Handler PROC
LDR r0, [r0] LDR r0, [r0]
STR r1, [r0] ; update from thread stack pointer STR r1, [r0] ; update from thread stack pointer
swtich_to_thread switch_to_thread
LDR r1, =rt_interrupt_to_thread LDR r1, =rt_interrupt_to_thread
LDR r1, [r1] LDR r1, [r1]
LDR r1, [r1] ; load thread stack pointer LDR r1, [r1] ; load thread stack pointer
......
...@@ -180,7 +180,7 @@ static void rt_thread_idle_entry(void *parameter) ...@@ -180,7 +180,7 @@ static void rt_thread_idle_entry(void *parameter)
} }
/** /**
* @ingroup SymstemInit * @ingroup SystemInit
* *
* This function will initialize idle thread, then start it. * This function will initialize idle thread, then start it.
* *
......
...@@ -12,24 +12,44 @@ Env = None ...@@ -12,24 +12,44 @@ Env = None
class Win32Spawn: class Win32Spawn:
def spawn(self, sh, escape, cmd, args, env): def spawn(self, sh, escape, cmd, args, env):
# deal with the cmd build-in commands which cannot be used in
# subprocess.Popen
if cmd == 'del':
for f in args[1:]:
try:
os.remove(f)
except Exception as e:
print 'Error removing file: %s' % e
return -1
return 0
import subprocess import subprocess
newargs = string.join(args[1:], ' ') newargs = string.join(args[1:], ' ')
cmdline = cmd + " " + newargs cmdline = cmd + " " + newargs
startupinfo = subprocess.STARTUPINFO() startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
# Make sure the env is constructed by strings
_e = {k: str(v) for k, v in env.items()}
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE, # Windows(tm) CreateProcess does not use the env passed to it to find
stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False) # the executables. So we have to modify our own PATH to make Popen
data, err = proc.communicate() # work.
rv = proc.wait() old_path = os.environ['PATH']
if data: os.environ['PATH'] = _e['PATH']
print data
if err: try:
print err proc = subprocess.Popen(cmdline, env=_e,
startupinfo=startupinfo, shell=False)
except Exception as e:
print 'Error in calling:\n%s' % cmdline
print 'Exception: %s: %s' % (e, os.strerror(e.errno))
return e.errno
finally:
os.environ['PATH'] = old_path
if rv: return proc.wait()
return rv
return 0
def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = []): def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = []):
import SCons.cpp import SCons.cpp
...@@ -59,11 +79,11 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ ...@@ -59,11 +79,11 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
env['LIBDIRPREFIX'] = '--userlibpath ' env['LIBDIRPREFIX'] = '--userlibpath '
# patch for win32 spawn # patch for win32 spawn
if env['PLATFORM'] == 'win32' and rtconfig.PLATFORM == 'gcc': if env['PLATFORM'] == 'win32':
win32_spawn = Win32Spawn() win32_spawn = Win32Spawn()
win32_spawn.env = env win32_spawn.env = env
env['SPAWN'] = win32_spawn.spawn env['SPAWN'] = win32_spawn.spawn
if env['PLATFORM'] == 'win32': if env['PLATFORM'] == 'win32':
os.environ['PATH'] = rtconfig.EXEC_PATH + ";" + os.environ['PATH'] os.environ['PATH'] = rtconfig.EXEC_PATH + ";" + os.environ['PATH']
else: else:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册