芯片是STMH750,固件包版本STM32Cube FW_H7 V1.8.0,CubeMX 版本6.0.1。
1、不加入lwip,单跑FreeRTOS,运行正常;
2、加入lwip,检查ETH外设中断的优先级,将优先级调整比 configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 大,进入Hardfault,排除中断导致的可能;
3、增加各个任务的任务栈大小,由于是加入lwip后才出现的,所以先 分别 调整lwip相关的任务的颤凳栈大小为茄猛旅原来的4倍。共三个, EthLink 、 EthIf 和 tcpip_thread ,进入Hardfault,排除这三个任务的问题;
4、最后一个任务是启动任务 defaultTask ,调整该任务的栈大小,运行正常知悔。
第一步:用tftpserver.c中的err_t tftp_send_message(struct udp_pcb *upcb, struct ip_addr *to_ip, int to_port, char *buf, int buflen)向指定地址发送写文件请求侍饥锋;
第二步:用tftpserver.c中的void process_tftp_request(struct pbuf *pkt_buf, struct ip_addr *addr, u16_t port)函数处理回应,如果接收到回应后,process_tftp_request函数中的int tftp_process_write(struct udp_pcb *upcb, struct ip_addr *to, int to_port, char *FileName)函数发送数据文件。
基本流程就是上述所说,肢团但是tftp_send_message()函数中的参数struct udp_pcb *upcb,数据结构非常复老晌杂
struct udp_pcb {
/* Common members of all PCB types */
IP_PCB
/* Protocol specific PCB members */
struct udp_pcb *next
u8_t flags
/* ports are in host byte order */
u16_t local_port, remote_port
#if LWIP_IGMP
/* outgoing network interface for multicast packets */
struct ip_addr multicast_ip
#endif /* LWIP_IGMP */
#if LWIP_UDPLITE
/* used for UDP_LITE only */
u16_t chksum_len_rx, chksum_len_tx
#endif /* LWIP_UDPLITE */
/* receive callback function
* addr and port are in same byte order as in the pcb
* The callback is responsible for freeing the pbuf
* if it's not used any more.
*
* ATTENTION: Be aware that 'addr' points into the pbuf 'p' so freeing this pbuf
*makes 'addr' invalid, too.
*
* @param arg user supplied argument (udp_pcb.recv_arg)
* @param pcb the udp_pcb which received data
* @param p the packet buffer that was received
* @param addr the remote IP address from which the packet was received
* @param port the remote port from which the packet was received
*/
void (* recv)(void *arg, struct udp_pcb *pcb, struct pbuf *p,
struct ip_addr *addr, u16_t port)
/* user-supplied argument for the recv callback */
void *recv_arg
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)