Merge remote-tracking branch 'upstream/master'

This commit is contained in:
ZYH 2017-12-21 21:26:54 +08:00
commit fe27b9751c
23 changed files with 685 additions and 354 deletions

View File

@ -3027,6 +3027,9 @@ struct rt_stm32_eth
/* interface address info. */ /* interface address info. */
rt_uint8_t dev_addr[MAX_ADDR_LEN]; /* hw address */ rt_uint8_t dev_addr[MAX_ADDR_LEN]; /* hw address */
uint32_t ETH_HashTableHigh;
uint32_t ETH_HashTableLow;
}; };
static struct rt_stm32_eth stm32_eth_device; static struct rt_stm32_eth stm32_eth_device;
static struct rt_semaphore tx_buf_free; static struct rt_semaphore tx_buf_free;
@ -3082,10 +3085,118 @@ void ETH_IRQHandler(void)
/* RT-Thread Device Interface */ /* RT-Thread Device Interface */
#if (LWIP_IPV4 && LWIP_IGMP) || (LWIP_IPV6 && LWIP_IPV6_MLD)
/* polynomial: 0x04C11DB7 */
static uint32_t ethcrc(const uint8_t *data, size_t length)
{
uint32_t crc = 0xffffffff;
size_t i;
int j;
for (i = 0; i < length; i++)
{
for (j = 0; j < 8; j++)
{
if (((crc >> 31) ^ (data[i] >> j)) & 0x01)
{
/* x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1 */
crc = (crc << 1) ^ 0x04C11DB7;
}
else
{
crc = crc << 1;
}
}
}
return ~crc;
}
#define HASH_BITS 6 /* #bits in hash */
static void register_multicast_address(struct rt_stm32_eth *stm32_eth, const uint8_t *mac)
{
uint32_t crc;
uint8_t hash;
/* calculate crc32 value of mac address */
crc = ethcrc(mac, 6);
/* only upper 6 bits (HASH_BITS) are used
* which point to specific bit in he hash registers
*/
hash = (crc >> 26) & 0x3F;
//rt_kprintf("register_multicast_address crc: %08X hash: %02X\n", crc, hash);
if (hash > 31)
{
stm32_eth->ETH_HashTableHigh |= 1 << (hash - 32);
ETH->MACHTHR = stm32_eth->ETH_HashTableHigh;
}
else
{
stm32_eth->ETH_HashTableLow |= 1 << hash;
ETH->MACHTLR = stm32_eth->ETH_HashTableLow;
}
}
#endif /* (LWIP_IPV4 && LWIP_IGMP) || (LWIP_IPV6 && LWIP_IPV6_MLD) */
#if LWIP_IPV4 && LWIP_IGMP
static err_t igmp_mac_filter( struct netif *netif, const ip4_addr_t *ip4_addr, u8_t action )
{
uint8_t mac[6];
const uint8_t *p = (const uint8_t *)ip4_addr;
struct rt_stm32_eth *stm32_eth = (struct rt_stm32_eth *)netif->state;
mac[0] = 0x01;
mac[1] = 0x00;
mac[2] = 0x5E;
mac[3] = *(p+1) & 0x7F;
mac[4] = *(p+2);
mac[5] = *(p+3);
register_multicast_address(stm32_eth, mac);
if(1)
{
rt_kprintf("%s %s %s ", __FUNCTION__, (action==NETIF_ADD_MAC_FILTER)?"add":"del", ip4addr_ntoa(ip4_addr));
rt_kprintf("%02X:%02X:%02X:%02X:%02X:%02X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}
return 0;
}
#endif /* LWIP_IPV4 && LWIP_IGMP */
#if LWIP_IPV6 && LWIP_IPV6_MLD
static err_t mld_mac_filter( struct netif *netif, const ip6_addr_t *ip6_addr, u8_t action )
{
uint8_t mac[6];
const uint8_t *p = (const uint8_t *)&ip6_addr->addr[3];
struct rt_stm32_eth *stm32_eth = (struct rt_stm32_eth *)netif->state;
mac[0] = 0x33;
mac[1] = 0x33;
mac[2] = *(p+0);
mac[3] = *(p+1);
mac[4] = *(p+2);
mac[5] = *(p+3);
register_multicast_address(stm32_eth, mac);
if(1)
{
rt_kprintf("%s %s %s ", __FUNCTION__, (action==NETIF_ADD_MAC_FILTER)?"add":"del", ip6addr_ntoa(ip6_addr));
rt_kprintf("%02X:%02X:%02X:%02X:%02X:%02X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}
return 0;
}
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
/* initialize the interface */ /* initialize the interface */
static rt_err_t rt_stm32_eth_init(rt_device_t dev) static rt_err_t rt_stm32_eth_init(rt_device_t dev)
{ {
vu32 Value = 0; vu32 Value = 0;
struct rt_stm32_eth * stm32_eth = (struct rt_stm32_eth *)dev;
/* Reset ETHERNET on AHB Bus */ /* Reset ETHERNET on AHB Bus */
ETH_DeInit(); ETH_DeInit();
@ -3112,7 +3223,9 @@ static rt_err_t rt_stm32_eth_init(rt_device_t dev)
ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Enable; ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Enable;
ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Disable; ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Disable;
ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable; ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;
ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect; ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_HashTable;
ETH_InitStructure.ETH_HashTableHigh = stm32_eth->ETH_HashTableHigh;
ETH_InitStructure.ETH_HashTableLow = stm32_eth->ETH_HashTableLow;
ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect; ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;
#if CHECKSUM_BY_HARDWARE #if CHECKSUM_BY_HARDWARE
ETH_InitStructure.ETH_ChecksumOffload = ETH_ChecksumOffload_Enable; ETH_InitStructure.ETH_ChecksumOffload = ETH_ChecksumOffload_Enable;
@ -3153,6 +3266,14 @@ static rt_err_t rt_stm32_eth_init(rt_device_t dev)
/* Enable MAC and DMA transmission and reception */ /* Enable MAC and DMA transmission and reception */
ETH_Start(); ETH_Start();
#if LWIP_IPV4 && LWIP_IGMP
netif_set_igmp_mac_filter(stm32_eth->parent.netif, igmp_mac_filter);
#endif /* LWIP_IPV4 && LWIP_IGMP */
#if LWIP_IPV6 && LWIP_IPV6_MLD
netif_set_mld_mac_filter(stm32_eth->parent.netif, mld_mac_filter);
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
return RT_EOK; return RT_EOK;
} }

View File

@ -3274,6 +3274,9 @@ struct rt_stm32_eth
uint32_t ETH_Speed; /*!< @ref ETH_Speed */ uint32_t ETH_Speed; /*!< @ref ETH_Speed */
uint32_t ETH_Mode; /*!< @ref ETH_Duplex_Mode */ uint32_t ETH_Mode; /*!< @ref ETH_Duplex_Mode */
uint32_t ETH_HashTableHigh;
uint32_t ETH_HashTableLow;
}; };
static struct rt_stm32_eth stm32_eth_device; static struct rt_stm32_eth stm32_eth_device;
static struct rt_semaphore tx_wait; static struct rt_semaphore tx_wait;
@ -3408,6 +3411,113 @@ void ETH_IRQHandler(void)
#include <lwip/icmp.h> #include <lwip/icmp.h>
#include "lwipopts.h" #include "lwipopts.h"
#if (LWIP_IPV4 && LWIP_IGMP) || (LWIP_IPV6 && LWIP_IPV6_MLD)
/* polynomial: 0x04C11DB7 */
static uint32_t ethcrc(const uint8_t *data, size_t length)
{
uint32_t crc = 0xffffffff;
size_t i;
int j;
for (i = 0; i < length; i++)
{
for (j = 0; j < 8; j++)
{
if (((crc >> 31) ^ (data[i] >> j)) & 0x01)
{
/* x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1 */
crc = (crc << 1) ^ 0x04C11DB7;
}
else
{
crc = crc << 1;
}
}
}
return ~crc;
}
#define HASH_BITS 6 /* #bits in hash */
static void register_multicast_address(struct rt_stm32_eth *stm32_eth, const uint8_t *mac)
{
uint32_t crc;
uint8_t hash;
/* calculate crc32 value of mac address */
crc = ethcrc(mac, 6);
/* only upper 6 bits (HASH_BITS) are used
* which point to specific bit in he hash registers
*/
hash = (crc >> 26) & 0x3F;
//rt_kprintf("register_multicast_address crc: %08X hash: %02X\n", crc, hash);
if (hash > 31)
{
stm32_eth->ETH_HashTableHigh |= 1 << (hash - 32);
ETH->MACHTHR = stm32_eth->ETH_HashTableHigh;
}
else
{
stm32_eth->ETH_HashTableLow |= 1 << hash;
ETH->MACHTLR = stm32_eth->ETH_HashTableLow;
}
}
#endif /* (LWIP_IPV4 && LWIP_IGMP) || (LWIP_IPV6 && LWIP_IPV6_MLD) */
#if LWIP_IPV4 && LWIP_IGMP
static err_t igmp_mac_filter( struct netif *netif, const ip4_addr_t *ip4_addr, u8_t action )
{
uint8_t mac[6];
const uint8_t *p = (const uint8_t *)ip4_addr;
struct rt_stm32_eth *stm32_eth = (struct rt_stm32_eth *)netif->state;
mac[0] = 0x01;
mac[1] = 0x00;
mac[2] = 0x5E;
mac[3] = *(p+1) & 0x7F;
mac[4] = *(p+2);
mac[5] = *(p+3);
register_multicast_address(stm32_eth, mac);
if(1)
{
rt_kprintf("%s %s %s ", __FUNCTION__, (action==NETIF_ADD_MAC_FILTER)?"add":"del", ip4addr_ntoa(ip4_addr));
rt_kprintf("%02X:%02X:%02X:%02X:%02X:%02X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}
return 0;
}
#endif /* LWIP_IPV4 && LWIP_IGMP */
#if LWIP_IPV6 && LWIP_IPV6_MLD
static err_t mld_mac_filter( struct netif *netif, const ip6_addr_t *ip6_addr, u8_t action )
{
uint8_t mac[6];
const uint8_t *p = (const uint8_t *)&ip6_addr->addr[3];
struct rt_stm32_eth *stm32_eth = (struct rt_stm32_eth *)netif->state;
mac[0] = 0x33;
mac[1] = 0x33;
mac[2] = *(p+0);
mac[3] = *(p+1);
mac[4] = *(p+2);
mac[5] = *(p+3);
register_multicast_address(stm32_eth, mac);
if(1)
{
rt_kprintf("%s %s %s ", __FUNCTION__, (action==NETIF_ADD_MAC_FILTER)?"add":"del", ip6addr_ntoa(ip6_addr));
rt_kprintf("%02X:%02X:%02X:%02X:%02X:%02X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}
return 0;
}
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
/* initialize the interface */ /* initialize the interface */
static rt_err_t rt_stm32_eth_init(rt_device_t dev) static rt_err_t rt_stm32_eth_init(rt_device_t dev)
{ {
@ -3445,7 +3555,9 @@ static rt_err_t rt_stm32_eth_init(rt_device_t dev)
ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Disable; ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Disable;
ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Enable; ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Enable;
ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable; ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;
ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect; ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_HashTable;
ETH_InitStructure.ETH_HashTableHigh = stm32_eth->ETH_HashTableHigh;
ETH_InitStructure.ETH_HashTableLow = stm32_eth->ETH_HashTableLow;
ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect; ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;
#ifdef CHECKSUM_BY_HARDWARE #ifdef CHECKSUM_BY_HARDWARE
ETH_InitStructure.ETH_ChecksumOffload = ETH_ChecksumOffload_Enable; ETH_InitStructure.ETH_ChecksumOffload = ETH_ChecksumOffload_Enable;
@ -3486,6 +3598,14 @@ static rt_err_t rt_stm32_eth_init(rt_device_t dev)
/* Enable MAC and DMA transmission and reception */ /* Enable MAC and DMA transmission and reception */
ETH_Start(); ETH_Start();
#if LWIP_IPV4 && LWIP_IGMP
netif_set_igmp_mac_filter(stm32_eth->parent.netif, igmp_mac_filter);
#endif /* LWIP_IPV4 && LWIP_IGMP */
#if LWIP_IPV6 && LWIP_IPV6_MLD
netif_set_mld_mac_filter(stm32_eth->parent.netif, mld_mac_filter);
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
return RT_EOK; return RT_EOK;
} }

20
components/CMSIS/Kconfig Normal file
View File

@ -0,0 +1,20 @@
if ARCH_ARM_CORTEX_M
menu "ARM CMSIS"
config RT_USING_CMSIS_OS
bool "Using CMSIS RTOS API"
default n
help
Enable CMSIS RTOS API, which is implemented above RT-Thread.
config RT_USING_RTT_CMSIS
bool "Using CMSIS Header files in RT-Thread"
default n
help
Use CMSIS header files in RT-Thread/components/CMSIS. Otherwise, use the
CMSIS header files in BSP.
endmenu
endif

View File

@ -28,4 +28,6 @@ source "$RTT_DIR/components/vbus/Kconfig"
source "$RTT_DIR/components/utilities/Kconfig" source "$RTT_DIR/components/utilities/Kconfig"
source "$RTT_DIR/components/CMSIS/Kconfig"
endmenu endmenu

View File

@ -13,14 +13,17 @@ if RT_USING_DFS
config DFS_FILESYSTEMS_MAX config DFS_FILESYSTEMS_MAX
int "The maximal number of mounted file system" int "The maximal number of mounted file system"
default 4 if RT_USING_DFS_NFS
default 2 default 2
config DFS_FILESYSTEM_TYPES_MAX config DFS_FILESYSTEM_TYPES_MAX
int "The maximal number of file system type" int "The maximal number of file system type"
default 4 if RT_USING_DFS_NFS
default 2 default 2
config DFS_FD_MAX config DFS_FD_MAX
int "The maximal number of opened files" int "The maximal number of opened files"
default 16 if RT_USING_DFS_NFS
default 4 default 4
config RT_USING_DFS_ELMFAT config RT_USING_DFS_ELMFAT
@ -156,7 +159,7 @@ if RT_USING_DFS
config RT_USING_DFS_NFS config RT_USING_DFS_NFS
bool "Using NFS v3 client file system" bool "Using NFS v3 client file system"
depends on RT_USING_LWIP select RT_USING_LWIP
default n default n
if RT_USING_DFS_NFS if RT_USING_DFS_NFS

View File

@ -27,7 +27,7 @@ config RT_USING_LWIP
config RT_LWIP_IGMP config RT_LWIP_IGMP
bool "IGMP protocol" bool "IGMP protocol"
default n default y
config RT_LWIP_ICMP config RT_LWIP_ICMP
bool "ICMP protocol" bool "ICMP protocol"
@ -111,6 +111,7 @@ config RT_USING_LWIP
config RT_LWIP_UDP_PCB_NUM config RT_LWIP_UDP_PCB_NUM
int "the number of UDP socket" int "the number of UDP socket"
default 8 if RT_USING_DFS_NFS
default 4 default 4
if RT_LWIP_TCP if RT_LWIP_TCP

View File

@ -176,7 +176,23 @@ static err_t eth_netif_device_init(struct netif *netif)
netif->output_ip6 = ethip6_output; netif->output_ip6 = ethip6_output;
netif->ip6_autoconfig_enabled = 1; netif->ip6_autoconfig_enabled = 1;
netif_create_ip6_linklocal_address(netif, 1); netif_create_ip6_linklocal_address(netif, 1);
#if LWIP_IPV6_MLD
netif->flags |= NETIF_FLAG_MLD6; netif->flags |= NETIF_FLAG_MLD6;
/*
* For hardware/netifs that implement MAC filtering.
* All-nodes link-local is handled by default, so we must let the hardware know
* to allow multicast packets in.
* Should set mld_mac_filter previously. */
if (netif->mld_mac_filter != NULL)
{
ip6_addr_t ip6_allnodes_ll;
ip6_addr_set_allnodes_linklocal(&ip6_allnodes_ll);
netif->mld_mac_filter(netif, &ip6_allnodes_ll, NETIF_ADD_MAC_FILTER);
}
#endif /* LWIP_IPV6_MLD */
#endif /* LWIP_IPV6 */ #endif /* LWIP_IPV6 */
/* set default netif */ /* set default netif */

View File

@ -33,6 +33,14 @@ config ARCH_ARM_MMU
bool bool
depends on ARCH_ARM depends on ARCH_ARM
config ARCH_ARM_ARM9
bool
select ARCH_ARM
config ARCH_ARM_ARM11
bool
select ARCH_ARM
config ARCH_ARM_CORTEX_A config ARCH_ARM_CORTEX_A
bool bool
select ARCH_ARM select ARCH_ARM

View File

@ -32,24 +32,27 @@
rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
rt_uint8_t *stack_addr, void *texit) rt_uint8_t *stack_addr, void *texit)
{ {
unsigned long *stk; rt_uint32_t *stk;
stk = (unsigned long *)stack_addr; stack_addr += sizeof(rt_uint32_t);
*(stk) = (unsigned long)tentry; /* entry point */ stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
*(--stk) = (unsigned long)texit; /* lr */ stk = (rt_uint32_t *)stack_addr;
*(--stk) = 0; /* r12 */
*(--stk) = 0; /* r11 */ *(--stk) = (rt_uint32_t)tentry; /* entry point */
*(--stk) = 0; /* r10 */ *(--stk) = (rt_uint32_t)texit; /* lr */
*(--stk) = 0; /* r9 */ *(--stk) = 0xdeadbeef; /* r12 */
*(--stk) = 0; /* r8 */ *(--stk) = 0xdeadbeef; /* r11 */
*(--stk) = 0; /* r7 */ *(--stk) = 0xdeadbeef; /* r10 */
*(--stk) = 0; /* r6 */ *(--stk) = 0xdeadbeef; /* r9 */
*(--stk) = 0; /* r5 */ *(--stk) = 0xdeadbeef; /* r8 */
*(--stk) = 0; /* r4 */ *(--stk) = 0xdeadbeef; /* r7 */
*(--stk) = 0; /* r3 */ *(--stk) = 0xdeadbeef; /* r6 */
*(--stk) = 0; /* r2 */ *(--stk) = 0xdeadbeef; /* r5 */
*(--stk) = 0; /* r1 */ *(--stk) = 0xdeadbeef; /* r4 */
*(--stk) = (unsigned long)parameter; /* r0 : argument */ *(--stk) = 0xdeadbeef; /* r3 */
*(--stk) = 0xdeadbeef; /* r2 */
*(--stk) = 0xdeadbeef; /* r1 */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
*(--stk) = SVCMODE; /* cpsr */ *(--stk) = SVCMODE; /* cpsr */
*(--stk) = SVCMODE; /* spsr */ *(--stk) = SVCMODE; /* spsr */

View File

@ -33,24 +33,26 @@
rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
rt_uint8_t *stack_addr, void *texit) rt_uint8_t *stack_addr, void *texit)
{ {
unsigned long *stk; rt_uint32_t *stk;
stk = (unsigned long *)stack_addr; stack_addr += sizeof(rt_uint32_t);
*(stk) = (unsigned long)tentry; /* entry point */ stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
*(--stk) = (unsigned long)texit; /* lr */ stk = (rt_uint32_t *)stack_addr;
*(--stk) = 0; /* r12 */ *(--stk) = (rt_uint32_t)tentry; /* entry point */
*(--stk) = 0; /* r11 */ *(--stk) = (rt_uint32_t)texit; /* lr */
*(--stk) = 0; /* r10 */ *(--stk) = 0xdeadbeef; /* r12 */
*(--stk) = 0; /* r9 */ *(--stk) = 0xdeadbeef; /* r11 */
*(--stk) = 0; /* r8 */ *(--stk) = 0xdeadbeef; /* r10 */
*(--stk) = 0; /* r7 */ *(--stk) = 0xdeadbeef; /* r9 */
*(--stk) = 0; /* r6 */ *(--stk) = 0xdeadbeef; /* r8 */
*(--stk) = 0; /* r5 */ *(--stk) = 0xdeadbeef; /* r7 */
*(--stk) = 0; /* r4 */ *(--stk) = 0xdeadbeef; /* r6 */
*(--stk) = 0; /* r3 */ *(--stk) = 0xdeadbeef; /* r5 */
*(--stk) = 0; /* r2 */ *(--stk) = 0xdeadbeef; /* r4 */
*(--stk) = 0; /* r1 */ *(--stk) = 0xdeadbeef; /* r3 */
*(--stk) = (unsigned long)parameter; /* r0 : argument */ *(--stk) = 0xdeadbeef; /* r2 */
*(--stk) = 0xdeadbeef; /* r1 */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
*(--stk) = SVCMODE; /* cpsr */ *(--stk) = SVCMODE; /* cpsr */
*(--stk) = SVCMODE; /* spsr */ *(--stk) = SVCMODE; /* spsr */

View File

@ -35,21 +35,24 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
{ {
rt_uint32_t *stk; rt_uint32_t *stk;
stk = (rt_uint32_t*)stack_addr; stack_addr += sizeof(rt_uint32_t);
*(stk) = (rt_uint32_t)tentry; /* entry point */ stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
stk = (rt_uint32_t *)stack_addr;
*(--stk) = (rt_uint32_t)tentry; /* entry point */
*(--stk) = (rt_uint32_t)texit; /* lr */ *(--stk) = (rt_uint32_t)texit; /* lr */
*(--stk) = 0; /* r12 */ *(--stk) = 0xdeadbeef; /* r12 */
*(--stk) = 0; /* r11 */ *(--stk) = 0xdeadbeef; /* r11 */
*(--stk) = 0; /* r10 */ *(--stk) = 0xdeadbeef; /* r10 */
*(--stk) = 0; /* r9 */ *(--stk) = 0xdeadbeef; /* r9 */
*(--stk) = 0; /* r8 */ *(--stk) = 0xdeadbeef; /* r8 */
*(--stk) = 0; /* r7 */ *(--stk) = 0xdeadbeef; /* r7 */
*(--stk) = 0; /* r6 */ *(--stk) = 0xdeadbeef; /* r6 */
*(--stk) = 0; /* r5 */ *(--stk) = 0xdeadbeef; /* r5 */
*(--stk) = 0; /* r4 */ *(--stk) = 0xdeadbeef; /* r4 */
*(--stk) = 0; /* r3 */ *(--stk) = 0xdeadbeef; /* r3 */
*(--stk) = 0; /* r2 */ *(--stk) = 0xdeadbeef; /* r2 */
*(--stk) = 0; /* r1 */ *(--stk) = 0xdeadbeef; /* r1 */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
/* cpsr */ /* cpsr */

View File

@ -50,7 +50,6 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
{ {
rt_uint32_t *stk; rt_uint32_t *stk;
//stk = (rt_uint32_t*)stack_addr;
stack_addr += sizeof(rt_uint32_t); stack_addr += sizeof(rt_uint32_t);
stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8); stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
stk = (rt_uint32_t *)stack_addr; stk = (rt_uint32_t *)stack_addr;

View File

@ -50,21 +50,24 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
{ {
rt_uint32_t *stk; rt_uint32_t *stk;
stk = (rt_uint32_t*)stack_addr; stack_addr += sizeof(rt_uint32_t);
*(stk) = (rt_uint32_t)tentry; /* entry point */ stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
stk = (rt_uint32_t *)stack_addr;
*(--stk) = (rt_uint32_t)tentry; /* entry point */
*(--stk) = (rt_uint32_t)texit; /* lr */ *(--stk) = (rt_uint32_t)texit; /* lr */
*(--stk) = 0; /* r12 */ *(--stk) = 0xdeadbeef; /* r12 */
*(--stk) = 0; /* r11 */ *(--stk) = 0xdeadbeef; /* r11 */
*(--stk) = 0; /* r10 */ *(--stk) = 0xdeadbeef; /* r10 */
*(--stk) = 0; /* r9 */ *(--stk) = 0xdeadbeef; /* r9 */
*(--stk) = 0; /* r8 */ *(--stk) = 0xdeadbeef; /* r8 */
*(--stk) = 0; /* r7 */ *(--stk) = 0xdeadbeef; /* r7 */
*(--stk) = 0; /* r6 */ *(--stk) = 0xdeadbeef; /* r6 */
*(--stk) = 0; /* r5 */ *(--stk) = 0xdeadbeef; /* r5 */
*(--stk) = 0; /* r4 */ *(--stk) = 0xdeadbeef; /* r4 */
*(--stk) = 0; /* r3 */ *(--stk) = 0xdeadbeef; /* r3 */
*(--stk) = 0; /* r2 */ *(--stk) = 0xdeadbeef; /* r2 */
*(--stk) = 0; /* r1 */ *(--stk) = 0xdeadbeef; /* r1 */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
/* cpsr */ /* cpsr */

View File

@ -36,21 +36,23 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
{ {
rt_uint32_t *stk; rt_uint32_t *stk;
stk = (rt_uint32_t*)stack_addr; stack_addr += sizeof(rt_uint32_t);
*(stk) = (rt_uint32_t)tentry; /* entry point */ stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
stk = (rt_uint32_t *)stack_addr;
*(--stk) = (rt_uint32_t)tentry; /* entry point */
*(--stk) = (rt_uint32_t)texit; /* lr */ *(--stk) = (rt_uint32_t)texit; /* lr */
*(--stk) = 0; /* r12 */ *(--stk) = 0xdeadbeef; /* r12 */
*(--stk) = 0; /* r11 */ *(--stk) = 0xdeadbeef; /* r11 */
*(--stk) = 0; /* r10 */ *(--stk) = 0xdeadbeef; /* r10 */
*(--stk) = 0; /* r9 */ *(--stk) = 0xdeadbeef; /* r9 */
*(--stk) = 0; /* r8 */ *(--stk) = 0xdeadbeef; /* r8 */
*(--stk) = 0; /* r7 */ *(--stk) = 0xdeadbeef; /* r7 */
*(--stk) = 0; /* r6 */ *(--stk) = 0xdeadbeef; /* r6 */
*(--stk) = 0; /* r5 */ *(--stk) = 0xdeadbeef; /* r5 */
*(--stk) = 0; /* r4 */ *(--stk) = 0xdeadbeef; /* r4 */
*(--stk) = 0; /* r3 */ *(--stk) = 0xdeadbeef; /* r3 */
*(--stk) = 0; /* r2 */ *(--stk) = 0xdeadbeef; /* r2 */
*(--stk) = 0; /* r1 */ *(--stk) = 0xdeadbeef; /* r1 */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
/* cpsr */ /* cpsr */

View File

@ -33,24 +33,26 @@
rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
rt_uint8_t *stack_addr, void *texit) rt_uint8_t *stack_addr, void *texit)
{ {
unsigned long *stk; rt_uint32_t *stk;
stk = (unsigned long*)stack_addr; stack_addr += sizeof(rt_uint32_t);
*( stk) = (unsigned long) tentry; /* entry point */ stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
*(--stk) = (unsigned long) texit; /* lr */ stk = (rt_uint32_t *)stack_addr;
*(--stk) = 0; /* r12 */ *(--stk) = (rt_uint32_t)tentry; /* entry point */
*(--stk) = 0; /* r11 */ *(--stk) = (rt_uint32_t)texit; /* lr */
*(--stk) = 0; /* r10 */ *(--stk) = 0xdeadbeef; /* r12 */
*(--stk) = 0; /* r9 */ *(--stk) = 0xdeadbeef; /* r11 */
*(--stk) = 0; /* r8 */ *(--stk) = 0xdeadbeef; /* r10 */
*(--stk) = 0; /* r7 */ *(--stk) = 0xdeadbeef; /* r9 */
*(--stk) = 0; /* r6 */ *(--stk) = 0xdeadbeef; /* r8 */
*(--stk) = 0; /* r5 */ *(--stk) = 0xdeadbeef; /* r7 */
*(--stk) = 0; /* r4 */ *(--stk) = 0xdeadbeef; /* r6 */
*(--stk) = 0; /* r3 */ *(--stk) = 0xdeadbeef; /* r5 */
*(--stk) = 0; /* r2 */ *(--stk) = 0xdeadbeef; /* r4 */
*(--stk) = 0; /* r1 */ *(--stk) = 0xdeadbeef; /* r3 */
*(--stk) = (unsigned long)parameter; /* r0 : argument */ *(--stk) = 0xdeadbeef; /* r2 */
*(--stk) = 0xdeadbeef; /* r1 */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
/* cpsr */ /* cpsr */
if ((rt_uint32_t)tentry & 0x01) if ((rt_uint32_t)tentry & 0x01)

View File

@ -50,21 +50,23 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
{ {
rt_uint32_t *stk; rt_uint32_t *stk;
stk = (rt_uint32_t*)stack_addr; stack_addr += sizeof(rt_uint32_t);
*(stk) = (rt_uint32_t)tentry; /* entry point */ stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
stk = (rt_uint32_t *)stack_addr;
*(--stk) = (rt_uint32_t)tentry; /* entry point */
*(--stk) = (rt_uint32_t)texit; /* lr */ *(--stk) = (rt_uint32_t)texit; /* lr */
*(--stk) = 0; /* r12 */ *(--stk) = 0xdeadbeef; /* r12 */
*(--stk) = 0; /* r11 */ *(--stk) = 0xdeadbeef; /* r11 */
*(--stk) = 0; /* r10 */ *(--stk) = 0xdeadbeef; /* r10 */
*(--stk) = 0; /* r9 */ *(--stk) = 0xdeadbeef; /* r9 */
*(--stk) = 0; /* r8 */ *(--stk) = 0xdeadbeef; /* r8 */
*(--stk) = 0; /* r7 */ *(--stk) = 0xdeadbeef; /* r7 */
*(--stk) = 0; /* r6 */ *(--stk) = 0xdeadbeef; /* r6 */
*(--stk) = 0; /* r5 */ *(--stk) = 0xdeadbeef; /* r5 */
*(--stk) = 0; /* r4 */ *(--stk) = 0xdeadbeef; /* r4 */
*(--stk) = 0; /* r3 */ *(--stk) = 0xdeadbeef; /* r3 */
*(--stk) = 0; /* r2 */ *(--stk) = 0xdeadbeef; /* r2 */
*(--stk) = 0; /* r1 */ *(--stk) = 0xdeadbeef; /* r1 */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
/* cpsr */ /* cpsr */

View File

@ -32,24 +32,27 @@
rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
rt_uint8_t *stack_addr, void *texit) rt_uint8_t *stack_addr, void *texit)
{ {
unsigned long *stk; rt_uint32_t *stk;
stk = (unsigned long *)stack_addr; stack_addr += sizeof(rt_uint32_t);
*(stk) = (unsigned long)tentry; /* entry point */ stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
*(--stk) = (unsigned long)texit; /* lr */ stk = (rt_uint32_t *)stack_addr;
*(--stk) = 0; /* r12 */
*(--stk) = 0; /* r11 */ *(--stk) = (rt_uint32_t)tentry; /* entry point */
*(--stk) = 0; /* r10 */ *(--stk) = (rt_uint32_t)texit; /* lr */
*(--stk) = 0; /* r9 */ *(--stk) = 0xdeadbeef; /* r12 */
*(--stk) = 0; /* r8 */ *(--stk) = 0xdeadbeef; /* r11 */
*(--stk) = 0; /* r7 */ *(--stk) = 0xdeadbeef; /* r10 */
*(--stk) = 0; /* r6 */ *(--stk) = 0xdeadbeef; /* r9 */
*(--stk) = 0; /* r5 */ *(--stk) = 0xdeadbeef; /* r8 */
*(--stk) = 0; /* r4 */ *(--stk) = 0xdeadbeef; /* r7 */
*(--stk) = 0; /* r3 */ *(--stk) = 0xdeadbeef; /* r6 */
*(--stk) = 0; /* r2 */ *(--stk) = 0xdeadbeef; /* r5 */
*(--stk) = 0; /* r1 */ *(--stk) = 0xdeadbeef; /* r4 */
*(--stk) = (unsigned long)parameter; /* r0 : argument */ *(--stk) = 0xdeadbeef; /* r3 */
*(--stk) = 0xdeadbeef; /* r2 */
*(--stk) = 0xdeadbeef; /* r1 */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
/* cpsr */ /* cpsr */
if ((rt_uint32_t)tentry & 0x01) if ((rt_uint32_t)tentry & 0x01)

View File

@ -35,21 +35,23 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
{ {
rt_uint32_t *stk; rt_uint32_t *stk;
stk = (rt_uint32_t*)stack_addr; stack_addr += sizeof(rt_uint32_t);
*(stk) = (rt_uint32_t)tentry; /* entry point */ stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
stk = (rt_uint32_t *)stack_addr;
*(--stk) = (rt_uint32_t)tentry; /* entry point */
*(--stk) = (rt_uint32_t)texit; /* lr */ *(--stk) = (rt_uint32_t)texit; /* lr */
*(--stk) = 0; /* r12 */ *(--stk) = 0xdeadbeef; /* r12 */
*(--stk) = 0; /* r11 */ *(--stk) = 0xdeadbeef; /* r11 */
*(--stk) = 0; /* r10 */ *(--stk) = 0xdeadbeef; /* r10 */
*(--stk) = 0; /* r9 */ *(--stk) = 0xdeadbeef; /* r9 */
*(--stk) = 0; /* r8 */ *(--stk) = 0xdeadbeef; /* r8 */
*(--stk) = 0; /* r7 */ *(--stk) = 0xdeadbeef; /* r7 */
*(--stk) = 0; /* r6 */ *(--stk) = 0xdeadbeef; /* r6 */
*(--stk) = 0; /* r5 */ *(--stk) = 0xdeadbeef; /* r5 */
*(--stk) = 0; /* r4 */ *(--stk) = 0xdeadbeef; /* r4 */
*(--stk) = 0; /* r3 */ *(--stk) = 0xdeadbeef; /* r3 */
*(--stk) = 0; /* r2 */ *(--stk) = 0xdeadbeef; /* r2 */
*(--stk) = 0; /* r1 */ *(--stk) = 0xdeadbeef; /* r1 */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
/* cpsr */ /* cpsr */

View File

@ -34,21 +34,24 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
{ {
rt_uint32_t *stk; rt_uint32_t *stk;
stk = (rt_uint32_t*)stack_addr; stack_addr += sizeof(rt_uint32_t);
*(stk) = (rt_uint32_t)tentry; /* entry point */ stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
stk = (rt_uint32_t *)stack_addr;
*(--stk) = (rt_uint32_t)tentry; /* entry point */
*(--stk) = (rt_uint32_t)texit; /* lr */ *(--stk) = (rt_uint32_t)texit; /* lr */
*(--stk) = 0; /* r12 */ *(--stk) = 0xdeadbeef; /* r12 */
*(--stk) = 0; /* r11 */ *(--stk) = 0xdeadbeef; /* r11 */
*(--stk) = 0; /* r10 */ *(--stk) = 0xdeadbeef; /* r10 */
*(--stk) = 0; /* r9 */ *(--stk) = 0xdeadbeef; /* r9 */
*(--stk) = 0; /* r8 */ *(--stk) = 0xdeadbeef; /* r8 */
*(--stk) = 0; /* r7 */ *(--stk) = 0xdeadbeef; /* r7 */
*(--stk) = 0; /* r6 */ *(--stk) = 0xdeadbeef; /* r6 */
*(--stk) = 0; /* r5 */ *(--stk) = 0xdeadbeef; /* r5 */
*(--stk) = 0; /* r4 */ *(--stk) = 0xdeadbeef; /* r4 */
*(--stk) = 0; /* r3 */ *(--stk) = 0xdeadbeef; /* r3 */
*(--stk) = 0; /* r2 */ *(--stk) = 0xdeadbeef; /* r2 */
*(--stk) = 0; /* r1 */ *(--stk) = 0xdeadbeef; /* r1 */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
*(--stk) = SVCMODE; /* cpsr */ *(--stk) = SVCMODE; /* cpsr */
*(--stk) = SVCMODE; /* spsr */ *(--stk) = SVCMODE; /* spsr */

View File

@ -32,24 +32,26 @@
rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
rt_uint8_t *stack_addr, void *texit) rt_uint8_t *stack_addr, void *texit)
{ {
unsigned long *stk; rt_uint32_t *stk;
stk = (unsigned long *)stack_addr; stack_addr += sizeof(rt_uint32_t);
*(stk) = (unsigned long)tentry; /* entry point */ stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
*(--stk) = (unsigned long)texit; /* lr */ stk = (rt_uint32_t *)stack_addr;
*(--stk) = 0; /* r12 */ *(--stk) = (rt_uint32_t)tentry; /* entry point */
*(--stk) = 0; /* r11 */ *(--stk) = (rt_uint32_t)texit; /* lr */
*(--stk) = 0; /* r10 */ *(--stk) = 0xdeadbeef; /* r12 */
*(--stk) = 0; /* r9 */ *(--stk) = 0xdeadbeef; /* r11 */
*(--stk) = 0; /* r8 */ *(--stk) = 0xdeadbeef; /* r10 */
*(--stk) = 0; /* r7 */ *(--stk) = 0xdeadbeef; /* r9 */
*(--stk) = 0; /* r6 */ *(--stk) = 0xdeadbeef; /* r8 */
*(--stk) = 0; /* r5 */ *(--stk) = 0xdeadbeef; /* r7 */
*(--stk) = 0; /* r4 */ *(--stk) = 0xdeadbeef; /* r6 */
*(--stk) = 0; /* r3 */ *(--stk) = 0xdeadbeef; /* r5 */
*(--stk) = 0; /* r2 */ *(--stk) = 0xdeadbeef; /* r4 */
*(--stk) = 0; /* r1 */ *(--stk) = 0xdeadbeef; /* r3 */
*(--stk) = (unsigned long)parameter; /* r0 : argument */ *(--stk) = 0xdeadbeef; /* r2 */
*(--stk) = 0xdeadbeef; /* r1 */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
*(--stk) = SVCMODE; /* cpsr */ *(--stk) = SVCMODE; /* cpsr */
*(--stk) = SVCMODE; /* spsr */ *(--stk) = SVCMODE; /* spsr */

View File

@ -33,21 +33,23 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
{ {
rt_uint32_t *stk; rt_uint32_t *stk;
stk = (rt_uint32_t*)stack_addr; stack_addr += sizeof(rt_uint32_t);
*(stk) = (rt_uint32_t)tentry; /* entry point */ stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
stk = (rt_uint32_t *)stack_addr;
*(--stk) = (rt_uint32_t)tentry; /* entry point */
*(--stk) = (rt_uint32_t)texit; /* lr */ *(--stk) = (rt_uint32_t)texit; /* lr */
*(--stk) = 0; /* r12 */ *(--stk) = 0xdeadbeef; /* r12 */
*(--stk) = 0; /* r11 */ *(--stk) = 0xdeadbeef; /* r11 */
*(--stk) = 0; /* r10 */ *(--stk) = 0xdeadbeef; /* r10 */
*(--stk) = 0; /* r9 */ *(--stk) = 0xdeadbeef; /* r9 */
*(--stk) = 0; /* r8 */ *(--stk) = 0xdeadbeef; /* r8 */
*(--stk) = 0; /* r7 */ *(--stk) = 0xdeadbeef; /* r7 */
*(--stk) = 0; /* r6 */ *(--stk) = 0xdeadbeef; /* r6 */
*(--stk) = 0; /* r5 */ *(--stk) = 0xdeadbeef; /* r5 */
*(--stk) = 0; /* r4 */ *(--stk) = 0xdeadbeef; /* r4 */
*(--stk) = 0; /* r3 */ *(--stk) = 0xdeadbeef; /* r3 */
*(--stk) = 0; /* r2 */ *(--stk) = 0xdeadbeef; /* r2 */
*(--stk) = 0; /* r1 */ *(--stk) = 0xdeadbeef; /* r1 */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
*(--stk) = Mode_SVC; /* cpsr */ *(--stk) = Mode_SVC; /* cpsr */
*(--stk) = Mode_SVC; /* spsr */ *(--stk) = Mode_SVC; /* spsr */

View File

@ -31,21 +31,23 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
{ {
rt_uint32_t *stk; rt_uint32_t *stk;
stack_addr += sizeof(rt_uint32_t);
stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
stk = (rt_uint32_t *)stack_addr; stk = (rt_uint32_t *)stack_addr;
*(stk) = (rt_uint32_t)tentry; /* entry point */ *(--stk) = (rt_uint32_t)tentry; /* entry point */
*(--stk) = (rt_uint32_t)texit; /* lr */ *(--stk) = (rt_uint32_t)texit; /* lr */
*(--stk) = 0; /* r12 */ *(--stk) = 0xdeadbeef; /* r12 */
*(--stk) = 0; /* r11 */ *(--stk) = 0xdeadbeef; /* r11 */
*(--stk) = 0; /* r10 */ *(--stk) = 0xdeadbeef; /* r10 */
*(--stk) = 0; /* r9 */ *(--stk) = 0xdeadbeef; /* r9 */
*(--stk) = 0; /* r8 */ *(--stk) = 0xdeadbeef; /* r8 */
*(--stk) = 0; /* r7 */ *(--stk) = 0xdeadbeef; /* r7 */
*(--stk) = 0; /* r6 */ *(--stk) = 0xdeadbeef; /* r6 */
*(--stk) = 0; /* r5 */ *(--stk) = 0xdeadbeef; /* r5 */
*(--stk) = 0; /* r4 */ *(--stk) = 0xdeadbeef; /* r4 */
*(--stk) = 0; /* r3 */ *(--stk) = 0xdeadbeef; /* r3 */
*(--stk) = 0; /* r2 */ *(--stk) = 0xdeadbeef; /* r2 */
*(--stk) = 0; /* r1 */ *(--stk) = 0xdeadbeef; /* r1 */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
/* cpsr */ /* cpsr */

View File

@ -80,7 +80,17 @@ def touch_env():
os.mkdir(env_dir) os.mkdir(env_dir)
os.mkdir(os.path.join(env_dir, 'local_pkgs')) os.mkdir(os.path.join(env_dir, 'local_pkgs'))
os.mkdir(os.path.join(env_dir, 'packages')) os.mkdir(os.path.join(env_dir, 'packages'))
os.system('git clone https://github.com/RT-Thread/packages.git ~/.env/packages/packages')
kconfig = file(os.path.join(env_dir, 'packages', 'Kconfig'), 'w') kconfig = file(os.path.join(env_dir, 'packages', 'Kconfig'), 'w')
kconfig.write('source "$PKGS_DIR/packages/Kconfig"')
os.mkdir(os.path.join(env_dir, 'tools'))
os.system('git clone https://github.com/RT-Thread/env.git ~/.env/tools/scripts')
env_sh = file(os.path.join(env_dir, 'env.sh'), 'w')
env_sh.write('export $PATH=~/.env/tools/scripts:$PATH')
# menuconfig for Linux # menuconfig for Linux
def menuconfig(RTT_ROOT): def menuconfig(RTT_ROOT):