Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
Network
tm4c129x
请教关于RTT、LWIP在TM4C129芯片上整合的问题。
发布于 2018-09-15 00:44:49 浏览:3363
订阅该版
我原来用TM4C129都是裸机工程,现在想移植一个操作系统,刚开始直接下载了3.0.3版本的,发现运行到创建任务时就出现问题了,如下图所示: 后来选择了RTThread-NANO版本,直接在我的裸机工程上进行修改、添加。 修改了board.c文件,内容如下: ```c #include
#include
#include "interrupt.h" #include "sysctl.h" #include "systick.h" #include "fpu.h" #include "rom_map.h" #include "drv_common.h" uint32_t SystemCoreClock; extern u32 g_u32SecCounter; extern void lwIPTimer(uint32_t ui32TimeMS); extern void PendSV_Handler(void); extern void HardFault_Handler(void); #define SYS_CLOCK_DEFAULT 120000000 #define FAULT_NMI 2 // NMI fault #define FAULT_HARD 3 // Hard fault #define FAULT_MPU 4 // MPU fault #define FAULT_BUS 5 // Bus fault #define FAULT_USAGE 6 // Usage fault #define FAULT_SVCALL 11 // SVCall #define FAULT_DEBUG 12 // Debug monitor #define FAULT_PENDSV 14 // PendSV #define FAULT_SYSTICK 15 // System Tick /**= * This is the timer interrupt service routine. * */ void SysTick_Handler(void) { static u32 tickets=0; const static u32 period_ms=1000/RT_TIMER_TICK_PER_SECOND; /* enter interrupt */ rt_interrupt_enter(); tickets++; if(tickets%RT_TIMER_TICK_PER_SECOND==0) { g_u32SecCounter++; } lwIPTimer(period_ms);//LWIP定时器 rt_tick_increase(); /* leave interrupt */ rt_interrupt_leave(); } #if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP) #define RT_HEAP_SIZE 4096 static uint32_t rt_heap[RT_HEAP_SIZE]; // heap default size: 4K(1024 * 4) RT_WEAK void *rt_heap_begin_get(void) { return rt_heap; } RT_WEAK void *rt_heap_end_get(void) { return rt_heap + RT_HEAP_SIZE; } #endif int rt_hw_cpu_init(void) { // MAP_IntMasterDisable(); IntRegister(FAULT_HARD, HardFault_Handler); IntRegister(FAULT_PENDSV, PendSV_Handler); IntRegister(FAULT_SYSTICK, SysTick_Handler); // Enable lazy stacking for interrupt handlers. This allows floating-point // instructions to be used within interrupt handlers, but at the expense of // extra stack usage. MAP_FPULazyStackingEnable(); // Set the clocking to run directly from the external crystal/oscillator. // TODO: The SYSCTL_XTAL_ value must be changed to match the value of the // crystal on your board. SystemCoreClock = MAP_SysCtlClockFreqSet( (SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), SYS_CLOCK_DEFAULT); MAP_SysTickDisable(); MAP_SysTickPeriodSet(SystemCoreClock/ RT_TICK_PER_SECOND - 1); MAP_SysTickIntEnable(); MAP_SysTickEnable(); return 0; } /** * This function will initial LPC40xx board. */ void rt_hw_board_init(void) { rt_hw_cpu_init(); DRV_CommonInit();//通用组件初始化 #if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP) rt_system_heap_init(rt_heap_begin_get(), rt_heap_end_get()); #endif //init low level drivers. e.g. cpu uart etc. // rt_components_board_init(); //redirect RTT stdio to CONSOLE device } ``` 配置文件如下: ```c /* RT-Thread config file */ #ifndef __RTTHREAD_CFG_H__ #define __RTTHREAD_CFG_H__ #include "RTE_Components.h" // <<< Use Configuration Wizard in Context Menu >>> //
Basic Configuration //
Maximal level of thread priority <8-256> //
Default: 32 #define RT_THREAD_PRIORITY_MAX 8 //
OS tick per second //
Default: 1000 (1ms) #define RT_TICK_PER_SECOND 100 //
Alignment size for CPU architecture data access //
Default: 4 #define RT_ALIGN_SIZE 4 //
the max length of object name<2-16> //
Default: 8 #define RT_NAME_MAX 8 //
Using RT-Thread components initialization //
Using RT-Thread components initialization #define RT_USING_COMPONENTS_INIT // //
Using user main //
Using user main #define RT_USING_USER_MAIN // //
the size of main thread<1-4086> //
Default: 512 #define RT_MAIN_THREAD_STACK_SIZE 256 //
//
Debug Configuration //
enable kernel debug configuration //
Default: enable kernel debug configuration //#define RT_DEBUG // //
enable components initialization debug configuration<0-1> //
Default: 0 #define RT_DEBUG_INIT 0 //
thread stack over flow detect //
Diable Thread stack over flow detect //#define RT_USING_OVERFLOW_CHECK // //
//
Hook Configuration //
using hook //
using hook //#define RT_USING_HOOK // //
using idle hook //
using idle hook //#define RT_USING_IDLE_HOOK // //
//
Software timers Configuration //
Enables user timers #define RT_USING_TIMER_SOFT 0 #if RT_USING_TIMER_SOFT == 0 #undef RT_USING_TIMER_SOFT #endif //
The priority level of timer thread <0-31> //
Default: 4 #define RT_TIMER_THREAD_PRIO 4 //
The stack size of timer thread <0-8192> //
Default: 512 #define RT_TIMER_THREAD_STACK_SIZE 512 //
The soft-timer tick per second <0-1000> //
Default: 100 #define RT_TIMER_TICK_PER_SECOND 100 //
//
IPC(Inter-process communication) Configuration //
Using Semaphore //
Using Semaphore #define RT_USING_SEMAPHORE // //
Using Mutex //
Using Mutex //#define RT_USING_MUTEX // //
Using Event //
Using Event //#define RT_USING_EVENT // //
Using MailBox //
Using MailBox #define RT_USING_MAILBOX // //
Using Message Queue //
Using Message Queue #define RT_USING_MESSAGEQUEUE // //
//
Memory Management Configuration //
Using Memory Pool Management //
Using Memory Pool Management //#define RT_USING_MEMPOOL // //
Dynamic Heap Management //
Dynamic Heap Management #define RT_USING_HEAP // //
using small memory //
using small memory #define RT_USING_SMALL_MEM // //
using tiny size of memory //
using tiny size of memory //#define RT_USING_TINY_SIZE // //
//
Console Configuration //
Using console //
Using console #define RT_USING_CONSOLE // //
the buffer size of console <1-1024> //
the buffer size of console //
Default: 128 (128Byte) #define RT_CONSOLEBUF_SIZE 128 //
The device name for console //
The device name for console //
Default: uart1 #define RT_CONSOLE_DEVICE_NAME "uart2" //
#if defined(RTE_FINSH_USING_MSH) #define RT_USING_FINSH #define FINSH_USING_MSH #define FINSH_USING_MSH_ONLY //
Finsh Configuration //
the priority of finsh thread <1-7> //
the priority of finsh thread //
Default: 6 #define __FINSH_THREAD_PRIORITY 5 #define FINSH_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX / 8 * __FINSH_THREAD_PRIORITY + 1) //
the stack of finsh thread <1-4096> //
the stack of finsh thread //
Default: 4096 (4096Byte) #define FINSH_THREAD_STACK_SIZE 512 //
the history lines of finsh thread <1-32> //
the history lines of finsh thread //
Default: 5 #define FINSH_HISTORY_LINES 1 //
Using symbol table in finsh shell //
Using symbol table in finsh shell #define FINSH_USING_SYMTAB // //
#endif #if defined(RTE_USING_DEVICE) #define RT_USING_DEVICE #endif // <<< end of configuration section >>> #endif ``` 现在的问题是 裸机情况下可以正常运行,一旦使用RTOS就停止在下图所示的函数了: 网卡初始化都是原来的函数: ```c void ETH_Init(void) { u8 i; uint32_t ipaddress=0,mask=0,gate=0; ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION); ROM_GPIOPinConfigure(GPIO_PF0_EN0LED0); ROM_GPIOPinConfigure(GPIO_PF4_EN0LED1); GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_4); // MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_1); // MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, ~GPIO_PIN_1); FlashEEPROM_Init();//读取配置信息 for(i=0;i<4;i++) { ipaddress<<=8; mask<<=8; gate<<=8; ipaddress|=ip2Mac.ip_addr
; mask|=ip2Mac.net_mask
; gate|=ip2Mac.ip_gate
; } printf("
static ip=%d.%d.%d.%d; mask=%d.%d.%d.%d; gate=%d.%d.%d.%d
desIP=%d.%d.%d.%d; desPORT=%d
", 0xff&ipaddress>>24,0xff&ipaddress>>16,0xff&ipaddress>>8,0xff&ipaddress, 0xff&mask>>24,0xff&mask>>16,0xff&mask>>8,0xff&mask, 0xff&gate>>24,0xff&gate>>16,0xff&gate>>8,0xff&gate, ip2Mac.dic_ip_addr[0],ip2Mac.dic_ip_addr[1],ip2Mac.dic_ip_addr[2],ip2Mac.dic_ip_addr[3], ip2Mac.dic_port[0]<<8|ip2Mac.dic_port[1] ); lwIPInit(120000000, ip2Mac.mac_address, ipaddress, mask, gate, IPADDR_USE_STATIC);//静态IP MAP_IntPrioritySet(INT_EMAC0, 0xC0); }
``` *** LWIP还没初始化完就死机了,根据这些信息可否判断问题的大致方向? ![QQ图片20180915003741.png](/uploads/201809/15/003801ekbmiyvtyybs6zsv.png) ![QQ截图20180915004209.png](/uploads/201809/15/004247gg2l81cvghnv2pgd.png)
查看更多
7
个回答
默认排序
按发布时间排序
aozima
2018-09-15
调网络不抓包,调I2C等时序不上逻辑分析仪,就像电工不用万用表!多用整理的好的文字,比截图更省流量,还能在整理过程中思考。
要用LWIP选择NANO是否走错了方向? 而且还是自己尝试加LWIP? 何不看看这个? [https://github.com/RT-Thread/rt-thread/tree/master/bsp/tm4c129x](https://github.com/RT-Thread/rt-thread/tree/master/bsp/tm4c129x)
ypp240124016
2018-09-15
这家伙很懒,什么也没写!
>要用LWIP选择NANO是否走错了方向? >而且还是自己尝试加LWIP? --- 官方的代码直接烧写进去也有问题(倒数第二张图),主要是完整版的有太多冗余的东西了,Linux风格的,实际用小型嵌入式时候用着不习惯,编译完后也太大了。所以想用NANO版本加已经移植好的LWIP这种形式。
bernard
2018-09-15
这家伙很懒,什么也没写!
nano + lwip,就南辕北辙了
JuiceNeco
2018-09-16
这家伙很懒,什么也没写!
1.报错的地方是在rt_application_init函数下的第212行 2.网卡初始化函数里包含了lwip协议栈的初始化,容易引发问题,可以重点关注下。
我夏了夏天
认证专家
2018-09-19
Life isn't about finding yourself, life is about creating yourself.
选择完整版慢慢往下减,我想比你自己移植要省事很多
ypp240124016
2018-09-22
这家伙很懒,什么也没写!
是这,初始化要用这个,INIT_COMPONENT_EXPORT(ETH_Init); 对RTT还未深入了解,暂时不清楚什么原因。
bear1
2019-06-21
这家伙很懒,什么也没写!
>nano + lwip,就南辕北辙了 --- 赞
撰写答案
登录
注册新账号
关注者
0
被浏览
3.4k
关于作者
ypp240124016
这家伙很懒,什么也没写!
提问
7
回答
10
被采纳
0
关注TA
发私信
相关问题
1
lwip1.4.1连接经常会断开无法连接上,可以ping通
2
LPC1768:RTT+LWIP+webserver用IE刷网页出现硬件中断错误(已经解决)
3
求一些LWIP开发的经验,目前ping一直不稳定。
4
stm32f207+dp83848无法ping通
5
RTT下的LWIP传递机制
6
rtt内lwip的socket是否是线程安全?
7
Lwip+enc28j60无法ping通
8
坑爹的rtconfig.h lwip关掉了checksum
9
花了一个晚上,把RT2.0的LWIP、网卡驱动、文件系统整合起来了,发现一点小问题
10
lwip例程中udp发送时如何指定源端口发送到指定目的地端口
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
[E/app.filesystem] SD card mount to '/sdcard' failed!
2
单片机也能聊天?RT-Thread上跑通大语言模型
3
【RT-Thread】【ci】【scons】将ci.attachconfig.yml和scons结合使用
4
Rt-thread中OTA下载后,bootloader不搬程序
5
ulog 日志 LOG_HEX 输出时间改为本地日期时间
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
USB
DMA
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
FAL
rt-smart
I2C_IIC
ESP8266
UART
WIZnet_W5500
ota在线升级
cubemx
PWM
flash
freemodbus
BSP
packages_软件包
潘多拉开发板_Pandora
定时器
ADC
flashDB
GD32
socket
编译报错
中断
Debug
rt_mq_消息队列_msg_queue
SFUD
msh
keil_MDK
ulog
C++_cpp
MicroPython
本月问答贡献
出出啊
1518
个答案
343
次被采纳
小小李sunny
1444
个答案
290
次被采纳
张世争
813
个答案
177
次被采纳
crystal266
547
个答案
161
次被采纳
whj467467222
1222
个答案
149
次被采纳
本月文章贡献
出出啊
1
篇文章
3
次点赞
小小李sunny
1
篇文章
1
次点赞
张世争
1
篇文章
3
次点赞
crystal266
2
篇文章
2
次点赞
whj467467222
2
篇文章
2
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部