五. STM32F407在没有操作系统下移植lwip
1.Cubemx配置过程
1.1 RCC配置(选择外部晶振)
1.2 SYS配置(时基选择Systick)
1.3 Eth配置我们以太网配置,我们已经在前面(CubeMx配置以太网芯片DP83848)做了说明,所以不再重复! 1.4 UART1配置(主要用来debug)
在这个基础上需要自己添加fputc函数(勾选micro lib)
int fputc(int ch, FILE *fp) { if (fp == stdout) { /*If you want to output a line feed, you can automatically add a carriage return to prevent the horizontal position of some terminal terminals from changing after line feed.*/ if (ch == '\n') { while ((USART1->SR & USART_SR_TXE) == 0); USART1->DR = '\r'; } /* Output characters to USART1 */ while ((USART1->SR & USART_SR_TXE) == 0); USART1->DR = ch; } return ch; }
|