mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-28 03:47:11 +08:00
Merge pull request #309 from BernardXiong/stable-v1.2.x
prepare RT-Thread 1.2.2 release
This commit is contained in:
commit
f6c8e39167
@ -426,7 +426,7 @@ int rt_hw_serial_init(void)
|
||||
config.stop_bits = STOP_BITS_1;
|
||||
config.invert = NRZ_NORMAL;
|
||||
serial3.ops = &am33xx_uart_ops;
|
||||
serial3.int_rx = &uart_3_int_rx;
|
||||
serial3.int_rx = &uart3_int_rx;
|
||||
serial3.config = config;
|
||||
/* enable RX interrupt */
|
||||
UART_IER_REG(uart3.base) = 0x01;
|
||||
|
@ -165,8 +165,8 @@ static void GPIO_Configuration(void)
|
||||
GPIO_Init(UART3_GPIO, &GPIO_InitStructure);
|
||||
|
||||
/* Connect alternate function */
|
||||
GPIO_PinAFConfig(UART2_GPIO, UART3_TX_PIN_SOURCE, GPIO_AF_USART3);
|
||||
GPIO_PinAFConfig(UART2_GPIO, UART3_RX_PIN_SOURCE, GPIO_AF_USART3);
|
||||
GPIO_PinAFConfig(UART3_GPIO, UART3_TX_PIN_SOURCE, GPIO_AF_USART3);
|
||||
GPIO_PinAFConfig(UART3_GPIO, UART3_RX_PIN_SOURCE, GPIO_AF_USART3);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -629,7 +629,15 @@ static void copyfile(const char *src, const char *dst)
|
||||
read_bytes = dfs_file_read(&src_fd, block_ptr, BUF_SZ);
|
||||
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);
|
||||
|
||||
|
@ -3,6 +3,14 @@
|
||||
#include <sys/time.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. */
|
||||
|
||||
int
|
||||
|
@ -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++);
|
||||
|
||||
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);
|
||||
if (result != RT_EOK)
|
||||
return EINVAL;
|
||||
|
@ -79,8 +79,8 @@ _reswitch:
|
||||
STR R1, [R0]
|
||||
BX LR
|
||||
|
||||
/* R0 --> swith from thread stack
|
||||
* R1 --> swith to thread stack
|
||||
/* R0 --> switch from thread stack
|
||||
* R1 --> switch to thread stack
|
||||
* psr, pc, LR, R12, R3, R2, R1, R0 are pushed into [from] stack
|
||||
*/
|
||||
.global PendSV_Handler
|
||||
@ -103,7 +103,7 @@ PendSV_Handler:
|
||||
LDR R0, =rt_interrupt_from_thread
|
||||
LDR R1, [R0]
|
||||
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 */
|
||||
|
||||
@ -118,7 +118,7 @@ PendSV_Handler:
|
||||
MOV R6, R10
|
||||
MOV R7, R11
|
||||
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, [R1]
|
||||
LDR R1, [R1] /* load thread stack pointer */
|
||||
|
@ -81,8 +81,8 @@ _reswitch
|
||||
STR r1, [r0]
|
||||
BX LR
|
||||
|
||||
; r0 --> swith from thread stack
|
||||
; r1 --> swith to thread stack
|
||||
; r0 --> switch from thread stack
|
||||
; r1 --> switch to thread stack
|
||||
; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
|
||||
EXPORT PendSV_Handler
|
||||
PendSV_Handler:
|
||||
@ -104,7 +104,7 @@ PendSV_Handler:
|
||||
LDR r0, =rt_interrupt_from_thread
|
||||
LDR r1, [r0]
|
||||
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
|
||||
|
||||
@ -120,7 +120,7 @@ PendSV_Handler:
|
||||
MOV r7, r11
|
||||
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, [r1]
|
||||
LDR r1, [r1] ; load thread stack pointer
|
||||
|
@ -85,8 +85,8 @@ _reswitch
|
||||
BX LR
|
||||
ENDP
|
||||
|
||||
; r0 --> swith from thread stack
|
||||
; r1 --> swith to thread stack
|
||||
; r0 --> switch from thread stack
|
||||
; r1 --> switch to thread stack
|
||||
; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
|
||||
PendSV_Handler PROC
|
||||
EXPORT PendSV_Handler
|
||||
@ -108,7 +108,7 @@ PendSV_Handler PROC
|
||||
LDR r0, =rt_interrupt_from_thread
|
||||
LDR r1, [r0]
|
||||
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
|
||||
|
||||
@ -124,7 +124,7 @@ PendSV_Handler PROC
|
||||
MOV r7, r11
|
||||
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, [r1]
|
||||
LDR r1, [r1] ; load thread stack pointer
|
||||
|
@ -80,8 +80,8 @@ _reswitch:
|
||||
STR R1, [R0]
|
||||
BX LR
|
||||
|
||||
/* R0 --> swith from thread stack
|
||||
* R1 --> swith to thread stack
|
||||
/* R0 --> switch from thread stack
|
||||
* R1 --> switch to thread stack
|
||||
* psr, pc, LR, R12, R3, R2, R1, R0 are pushed into [from] stack
|
||||
*/
|
||||
.global PendSV_Handler
|
||||
@ -102,14 +102,14 @@ PendSV_Handler:
|
||||
|
||||
LDR R0, =rt_interrupt_from_thread
|
||||
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 */
|
||||
STMFD R1!, {R4 - R11} /* push R4 - R11 register */
|
||||
LDR R0, [R0]
|
||||
STR R1, [R0] /* update from thread stack pointer */
|
||||
|
||||
swtich_to_thread:
|
||||
switch_to_thread:
|
||||
LDR R1, =rt_interrupt_to_thread
|
||||
LDR R1, [R1]
|
||||
LDR R1, [R1] /* load thread stack pointer */
|
||||
|
@ -81,8 +81,8 @@ _reswitch
|
||||
STR r1, [r0]
|
||||
BX LR
|
||||
|
||||
; r0 --> swith from thread stack
|
||||
; r1 --> swith to thread stack
|
||||
; r0 --> switch from thread stack
|
||||
; r1 --> switch to thread stack
|
||||
; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
|
||||
EXPORT PendSV_Handler
|
||||
PendSV_Handler:
|
||||
@ -102,14 +102,14 @@ PendSV_Handler:
|
||||
|
||||
LDR r0, =rt_interrupt_from_thread
|
||||
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
|
||||
STMFD r1!, {r4 - r11} ; push r4 - r11 register
|
||||
LDR r0, [r0]
|
||||
STR r1, [r0] ; update from thread stack pointer
|
||||
|
||||
swtich_to_thread
|
||||
switch_to_thread
|
||||
LDR r1, =rt_interrupt_to_thread
|
||||
LDR r1, [r1]
|
||||
LDR r1, [r1] ; load thread stack pointer
|
||||
|
@ -84,8 +84,8 @@ _reswitch
|
||||
BX LR
|
||||
ENDP
|
||||
|
||||
; r0 --> swith from thread stack
|
||||
; r1 --> swith to thread stack
|
||||
; r0 --> switch from thread stack
|
||||
; r1 --> switch to thread stack
|
||||
; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
|
||||
PendSV_Handler PROC
|
||||
EXPORT PendSV_Handler
|
||||
@ -105,14 +105,14 @@ PendSV_Handler PROC
|
||||
|
||||
LDR r0, =rt_interrupt_from_thread
|
||||
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
|
||||
STMFD r1!, {r4 - r11} ; push r4 - r11 register
|
||||
LDR r0, [r0]
|
||||
STR r1, [r0] ; update from thread stack pointer
|
||||
|
||||
swtich_to_thread
|
||||
switch_to_thread
|
||||
LDR r1, =rt_interrupt_to_thread
|
||||
LDR r1, [r1]
|
||||
LDR r1, [r1] ; load thread stack pointer
|
||||
|
@ -82,8 +82,8 @@ _reswitch:
|
||||
STR r1, [r0]
|
||||
BX LR
|
||||
|
||||
/* r0 --> swith from thread stack
|
||||
* r1 --> swith to thread stack
|
||||
/* r0 --> switch from thread stack
|
||||
* r1 --> switch to thread stack
|
||||
* psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
|
||||
*/
|
||||
.global PendSV_Handler
|
||||
@ -104,7 +104,7 @@ PendSV_Handler:
|
||||
|
||||
LDR r0, =rt_interrupt_from_thread
|
||||
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 */
|
||||
|
||||
@ -127,7 +127,7 @@ PendSV_Handler:
|
||||
LDR r0, [r0]
|
||||
STR r1, [r0] /* update from thread stack pointer */
|
||||
|
||||
swtich_to_thread:
|
||||
switch_to_thread:
|
||||
LDR r1, =rt_interrupt_to_thread
|
||||
LDR r1, [r1]
|
||||
LDR r1, [r1] /* load thread stack pointer */
|
||||
|
@ -82,8 +82,8 @@ _reswitch
|
||||
STR r1, [r0]
|
||||
BX LR
|
||||
|
||||
; r0 --> swith from thread stack
|
||||
; r1 --> swith to thread stack
|
||||
; r0 --> switch from thread stack
|
||||
; r1 --> switch to thread stack
|
||||
; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
|
||||
EXPORT PendSV_Handler
|
||||
PendSV_Handler:
|
||||
@ -103,7 +103,7 @@ PendSV_Handler:
|
||||
|
||||
LDR r0, =rt_interrupt_from_thread
|
||||
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
|
||||
|
||||
@ -130,7 +130,7 @@ push_flag
|
||||
LDR r0, [r0]
|
||||
STR r1, [r0] ; update from thread stack pointer
|
||||
|
||||
swtich_to_thread
|
||||
switch_to_thread
|
||||
LDR r1, =rt_interrupt_to_thread
|
||||
LDR r1, [r1]
|
||||
LDR r1, [r1] ; load thread stack pointer
|
||||
|
@ -85,8 +85,8 @@ _reswitch
|
||||
BX LR
|
||||
ENDP
|
||||
|
||||
; r0 --> swith from thread stack
|
||||
; r1 --> swith to thread stack
|
||||
; r0 --> switch from thread stack
|
||||
; r1 --> switch to thread stack
|
||||
; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
|
||||
PendSV_Handler PROC
|
||||
EXPORT PendSV_Handler
|
||||
@ -106,7 +106,7 @@ PendSV_Handler PROC
|
||||
|
||||
LDR r0, =rt_interrupt_from_thread
|
||||
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
|
||||
|
||||
@ -129,7 +129,7 @@ PendSV_Handler PROC
|
||||
LDR r0, [r0]
|
||||
STR r1, [r0] ; update from thread stack pointer
|
||||
|
||||
swtich_to_thread
|
||||
switch_to_thread
|
||||
LDR r1, =rt_interrupt_to_thread
|
||||
LDR r1, [r1]
|
||||
LDR r1, [r1] ; load thread stack pointer
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -12,24 +12,44 @@ Env = None
|
||||
|
||||
class Win32Spawn:
|
||||
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
|
||||
|
||||
newargs = string.join(args[1:], ' ')
|
||||
cmdline = cmd + " " + newargs
|
||||
startupinfo = subprocess.STARTUPINFO()
|
||||
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||
|
||||
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False)
|
||||
data, err = proc.communicate()
|
||||
rv = proc.wait()
|
||||
if data:
|
||||
print data
|
||||
if err:
|
||||
print err
|
||||
# Make sure the env is constructed by strings
|
||||
_e = {k: str(v) for k, v in env.items()}
|
||||
|
||||
if rv:
|
||||
return rv
|
||||
return 0
|
||||
# Windows(tm) CreateProcess does not use the env passed to it to find
|
||||
# the executables. So we have to modify our own PATH to make Popen
|
||||
# work.
|
||||
old_path = os.environ['PATH']
|
||||
os.environ['PATH'] = _e['PATH']
|
||||
|
||||
try:
|
||||
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
|
||||
|
||||
return proc.wait()
|
||||
|
||||
def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = []):
|
||||
import SCons.cpp
|
||||
@ -59,7 +79,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
|
||||
env['LIBDIRPREFIX'] = '--userlibpath '
|
||||
|
||||
# patch for win32 spawn
|
||||
if env['PLATFORM'] == 'win32' and rtconfig.PLATFORM == 'gcc':
|
||||
if env['PLATFORM'] == 'win32':
|
||||
win32_spawn = Win32Spawn()
|
||||
win32_spawn.env = env
|
||||
env['SPAWN'] = win32_spawn.spawn
|
||||
|
Loading…
x
Reference in New Issue
Block a user