Squashed commit of the following:
commit 8215a8352305704afaf54b389343e9f41365b40e Merge: fe7734162 18510fa80 Author: Bernard Xiong <bernard.xiong@gmail.com> Date: Wed Aug 15 08:47:26 2018 +0800 Merge pull request #1715 from heyuanjie87/syscall Syscall commit 18510fa80fef9751228935ef31e0b9fab9e3cdcc Author: heyuanjie87 <sc943313837@gmail.com> Date: Tue Aug 14 09:33:22 2018 +0800 Update select.c commit c90b449dac29e3e5a46a20988b043d283d3405d6 Author: heyuanjie87 <sc943313837@gmail.com> Date: Mon Aug 13 22:42:09 2018 +0800 Update select.c commit fe773416217b04d5873b9b6f4857b54e80b3d5e9 Merge: b571cd889 495927696 Author: Bernard Xiong <bernard.xiong@gmail.com> Date: Mon Aug 13 19:02:34 2018 +0800 Merge pull request #1717 from geniusgogo/fix_iar_project fixed IAR project add LIBS commit 495927696e759c7ec531bee6d8f33d6f5dfea27b Author: xieyangrun <xieyangrun@smartcomma.com> Date: Mon Aug 13 16:54:02 2018 +0800 fixed IAR project add LIBS commit b571cd8899ff37341f184dbded101d6ef434d8c1 Merge: 68edd04cb 250de62d5 Author: ZYH <lymz@foxmail.com> Date: Sun Aug 12 20:56:30 2018 +0800 Merge pull request #1714 from xeonxu/fix_pwm [STM32 BSP]Fix PWM channel calculate argorithm. commit d948dba42a7b2a219508ac28cf78e6e44f835dcf Author: heyuanjie87 <sc943313837@gmail.com> Date: Sun Aug 12 20:41:56 2018 +0800 update select.c commit fd209cb880f6d2d39b6265c09727182b55446bdf Author: heyuanjie <heyuanjie> Date: Sun Aug 12 20:26:16 2018 +0800 [lwp]添加select系统调用 commit 250de62d5c5ababe7c3ae2a752b0f53734fab0ad Author: Noe Xu <xeonxu@gmail.com> Date: Sun Aug 12 19:54:19 2018 +0800 [STM32 BSP]Fix PWM channel calculate argorithm. Change-Id: Ie65437365784033dcee8d8e9f21dfc5727ba9d3c
This commit is contained in:
parent
911e98e684
commit
305082fc45
@ -38,18 +38,21 @@ static struct rt_pwm_ops drv_ops =
|
|||||||
|
|
||||||
static rt_err_t drv_pwm_enable(TIM_HandleTypeDef * htim, struct rt_pwm_configuration *configuration, rt_bool_t enable)
|
static rt_err_t drv_pwm_enable(TIM_HandleTypeDef * htim, struct rt_pwm_configuration *configuration, rt_bool_t enable)
|
||||||
{
|
{
|
||||||
rt_uint32_t channel = 0x04 * configuration->channel;
|
rt_uint32_t channel = 0x04 * (configuration->channel - 1);
|
||||||
if(!enable)
|
if(!enable)
|
||||||
{
|
{
|
||||||
HAL_TIM_PWM_Stop(htim, channel);
|
HAL_TIM_PWM_Stop(htim, channel);
|
||||||
}
|
}
|
||||||
HAL_TIM_PWM_Start(htim, channel);
|
else
|
||||||
|
{
|
||||||
|
HAL_TIM_PWM_Start(htim, channel);
|
||||||
|
}
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static rt_err_t drv_pwm_get(TIM_HandleTypeDef * htim, struct rt_pwm_configuration *configuration)
|
static rt_err_t drv_pwm_get(TIM_HandleTypeDef * htim, struct rt_pwm_configuration *configuration)
|
||||||
{
|
{
|
||||||
rt_uint32_t channel = 0x04 * configuration->channel;
|
rt_uint32_t channel = 0x04 * (configuration->channel - 1);
|
||||||
rt_uint32_t tim_clock;
|
rt_uint32_t tim_clock;
|
||||||
#if (RT_HSE_HCLK > 100000000UL)//100M
|
#if (RT_HSE_HCLK > 100000000UL)//100M
|
||||||
if(htim->Instance == TIM1 && htim->Instance == TIM8)
|
if(htim->Instance == TIM1 && htim->Instance == TIM8)
|
||||||
@ -81,7 +84,7 @@ static rt_err_t drv_pwm_set(TIM_HandleTypeDef * htim, struct rt_pwm_configuratio
|
|||||||
{
|
{
|
||||||
rt_uint32_t period, pulse;
|
rt_uint32_t period, pulse;
|
||||||
rt_uint32_t tim_clock, psc;
|
rt_uint32_t tim_clock, psc;
|
||||||
rt_uint32_t channel = 0x04 * configuration->channel;
|
rt_uint32_t channel = 0x04 * (configuration->channel - 1);
|
||||||
#if (RT_HSE_HCLK > 100000000UL)//100M
|
#if (RT_HSE_HCLK > 100000000UL)//100M
|
||||||
if(htim->Instance == TIM1 && htim->Instance == TIM8)
|
if(htim->Instance == TIM1 && htim->Instance == TIM8)
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,23 @@
|
|||||||
#include <dfs_poll.h>
|
#include <dfs_poll.h>
|
||||||
#include <dfs_select.h>
|
#include <dfs_select.h>
|
||||||
|
|
||||||
|
static void fdszero(fd_set *set, int nfds)
|
||||||
|
{
|
||||||
|
fd_mask *m;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
/*
|
||||||
|
The 'sizeof(fd_set)' of the system space may differ from user space,
|
||||||
|
so the actual size of the 'fd_set' is determined here with the parameter 'nfds'
|
||||||
|
*/
|
||||||
|
m = (fd_mask*)set;
|
||||||
|
for (n = 0; n < nfds; n += (sizeof(fd_mask) * 8))
|
||||||
|
{
|
||||||
|
rt_memset(m, 0, sizeof(fd_mask));
|
||||||
|
m ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
|
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
@ -113,17 +130,17 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struc
|
|||||||
/* Now set up the return values */
|
/* Now set up the return values */
|
||||||
if (readfds)
|
if (readfds)
|
||||||
{
|
{
|
||||||
memset(readfds, 0, sizeof(fd_set));
|
fdszero(readfds, nfds);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (writefds)
|
if (writefds)
|
||||||
{
|
{
|
||||||
memset(writefds, 0, sizeof(fd_set));
|
fdszero(writefds, nfds);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exceptfds)
|
if (exceptfds)
|
||||||
{
|
{
|
||||||
memset(exceptfds, 0, sizeof(fd_set));
|
fdszero(exceptfds, nfds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the poll descriptor list back into selects 3 bitsets */
|
/* Convert the poll descriptor list back into selects 3 bitsets */
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include <lwp_syscall.h>
|
#include <lwp_syscall.h>
|
||||||
|
|
||||||
#include <dfs_poll.h>
|
#include <dfs_poll.h>
|
||||||
|
#include <dfs_select.h>
|
||||||
|
|
||||||
#if (defined(RT_USING_SAL) && defined(SAL_USING_POSIX))
|
#if (defined(RT_USING_SAL) && defined(SAL_USING_POSIX))
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
@ -235,7 +237,7 @@ const static void* func_table[] =
|
|||||||
|
|
||||||
(void *)sys_gettimeofday, // 0x0b
|
(void *)sys_gettimeofday, // 0x0b
|
||||||
(void *)sys_settimeofday, // 0x0c
|
(void *)sys_settimeofday, // 0x0c
|
||||||
|
|
||||||
(void *)sys_malloc, // 0x0d
|
(void *)sys_malloc, // 0x0d
|
||||||
(void *)sys_free, // 0x0e
|
(void *)sys_free, // 0x0e
|
||||||
(void *)sys_realloc, //0x0f
|
(void *)sys_realloc, //0x0f
|
||||||
@ -256,6 +258,8 @@ const static void* func_table[] =
|
|||||||
SYSCALL_NET(send), // 0x1d
|
SYSCALL_NET(send), // 0x1d
|
||||||
SYSCALL_NET(sendto), // 0x1e
|
SYSCALL_NET(sendto), // 0x1e
|
||||||
SYSCALL_NET(socket), // 0x1f
|
SYSCALL_NET(socket), // 0x1f
|
||||||
|
|
||||||
|
select, // 0x20
|
||||||
};
|
};
|
||||||
|
|
||||||
const void *lwp_get_sys_api(rt_uint32_t number)
|
const void *lwp_get_sys_api(rt_uint32_t number)
|
||||||
|
45
tools/iar.py
45
tools/iar.py
@ -49,31 +49,31 @@ def IARAddGroup(parent, name, files, project_path):
|
|||||||
group = SubElement(parent, 'group')
|
group = SubElement(parent, 'group')
|
||||||
group_name = SubElement(group, 'name')
|
group_name = SubElement(group, 'name')
|
||||||
group_name.text = name
|
group_name.text = name
|
||||||
|
|
||||||
for f in files:
|
for f in files:
|
||||||
fn = f.rfile()
|
fn = f.rfile()
|
||||||
name = fn.name
|
name = fn.name
|
||||||
path = os.path.dirname(fn.abspath)
|
path = os.path.dirname(fn.abspath)
|
||||||
|
|
||||||
basename = os.path.basename(path)
|
basename = os.path.basename(path)
|
||||||
path = _make_path_relative(project_path, path)
|
path = _make_path_relative(project_path, path)
|
||||||
path = os.path.join(path, name)
|
path = os.path.join(path, name)
|
||||||
|
|
||||||
file = SubElement(group, 'file')
|
file = SubElement(group, 'file')
|
||||||
file_name = SubElement(file, 'name')
|
file_name = SubElement(file, 'name')
|
||||||
|
|
||||||
if os.path.isabs(path):
|
if os.path.isabs(path):
|
||||||
file_name.text = path.decode(fs_encoding)
|
file_name.text = path.decode(fs_encoding)
|
||||||
else:
|
else:
|
||||||
file_name.text = ('$PROJ_DIR$\\' + path).decode(fs_encoding)
|
file_name.text = ('$PROJ_DIR$\\' + path).decode(fs_encoding)
|
||||||
|
|
||||||
def IARWorkspace(target):
|
def IARWorkspace(target):
|
||||||
# make an workspace
|
# make an workspace
|
||||||
workspace = target.replace('.ewp', '.eww')
|
workspace = target.replace('.ewp', '.eww')
|
||||||
out = file(workspace, 'wb')
|
out = file(workspace, 'wb')
|
||||||
xml = iar_workspace % target
|
xml = iar_workspace % target
|
||||||
out.write(xml)
|
out.write(xml)
|
||||||
out.close()
|
out.close()
|
||||||
|
|
||||||
def IARProject(target, script):
|
def IARProject(target, script):
|
||||||
project_path = os.path.dirname(os.path.abspath(target))
|
project_path = os.path.dirname(os.path.abspath(target))
|
||||||
|
|
||||||
@ -87,7 +87,19 @@ def IARProject(target, script):
|
|||||||
LINKFLAGS = ''
|
LINKFLAGS = ''
|
||||||
CCFLAGS = ''
|
CCFLAGS = ''
|
||||||
Libs = []
|
Libs = []
|
||||||
|
lib_prefix = ['lib', '']
|
||||||
|
lib_suffix = ['.a', '.o', '']
|
||||||
|
|
||||||
|
def searchLib(group):
|
||||||
|
for path_item in group['LIBPATH']:
|
||||||
|
for prefix_item in lib_prefix:
|
||||||
|
for suffix_item in lib_suffix:
|
||||||
|
lib_full_path = os.path.join(path_item, prefix_item + item + suffix_item)
|
||||||
|
if os.path.isfile(lib_full_path):
|
||||||
|
return lib_full_path
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
|
|
||||||
# add group
|
# add group
|
||||||
for group in script:
|
for group in script:
|
||||||
IARAddGroup(root, group['name'], group['src'], project_path)
|
IARAddGroup(root, group['name'], group['src'], project_path)
|
||||||
@ -95,29 +107,26 @@ def IARProject(target, script):
|
|||||||
# get each include path
|
# get each include path
|
||||||
if group.has_key('CPPPATH') and group['CPPPATH']:
|
if group.has_key('CPPPATH') and group['CPPPATH']:
|
||||||
CPPPATH += group['CPPPATH']
|
CPPPATH += group['CPPPATH']
|
||||||
|
|
||||||
# get each group's definitions
|
# get each group's definitions
|
||||||
if group.has_key('CPPDEFINES') and group['CPPDEFINES']:
|
if group.has_key('CPPDEFINES') and group['CPPDEFINES']:
|
||||||
CPPDEFINES += group['CPPDEFINES']
|
CPPDEFINES += group['CPPDEFINES']
|
||||||
|
|
||||||
# get each group's link flags
|
# get each group's link flags
|
||||||
if group.has_key('LINKFLAGS') and group['LINKFLAGS']:
|
if group.has_key('LINKFLAGS') and group['LINKFLAGS']:
|
||||||
LINKFLAGS += group['LINKFLAGS']
|
LINKFLAGS += group['LINKFLAGS']
|
||||||
|
|
||||||
if group.has_key('LIBS') and group['LIBS']:
|
if group.has_key('LIBS') and group['LIBS']:
|
||||||
for item in group['LIBS']:
|
for item in group['LIBS']:
|
||||||
lib_path = ''
|
lib_path = searchLib(group)
|
||||||
|
|
||||||
for path_item in group['LIBPATH']:
|
|
||||||
full_path = os.path.join(path_item, item + '.a')
|
|
||||||
if os.path.isfile(full_path): # has this library
|
|
||||||
lib_path = full_path
|
|
||||||
|
|
||||||
if lib_path != '':
|
if lib_path != '':
|
||||||
lib_path = _make_path_relative(project_path, lib_path)
|
lib_path = _make_path_relative(project_path, lib_path)
|
||||||
Libs += [lib_path]
|
Libs += [lib_path]
|
||||||
|
# print('found lib isfile: ' + lib_path)
|
||||||
|
else:
|
||||||
|
print('not found LIB: ' + item)
|
||||||
|
|
||||||
# make relative path
|
# make relative path
|
||||||
paths = set()
|
paths = set()
|
||||||
for path in CPPPATH:
|
for path in CPPPATH:
|
||||||
inc = _make_path_relative(project_path, os.path.normpath(path))
|
inc = _make_path_relative(project_path, os.path.normpath(path))
|
||||||
@ -156,7 +165,7 @@ def IARProject(target, script):
|
|||||||
out.close()
|
out.close()
|
||||||
|
|
||||||
IARWorkspace(target)
|
IARWorkspace(target)
|
||||||
|
|
||||||
def IARVersion():
|
def IARVersion():
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
|
Loading…
x
Reference in New Issue
Block a user