深圳做网站需要多少钱宜昌做网站的公司
2026/4/3 16:51:56 网站建设 项目流程
深圳做网站需要多少钱,宜昌做网站的公司,华秋商城,郑州艾特网站建设公司在上一篇的OpenBLT学习记录后#xff0c;我们完成了编译。实际上要离正常运行还需要再次的修改。 BootLoader在上个博客中#xff0c;完成了编译#xff0c;实际上没有调整对外设的设置#xff0c;还需要启动相关的外设。 一、Boot的参数设置以及代码添加 我们查看通讯初…在上一篇的OpenBLT学习记录后我们完成了编译。实际上要离正常运行还需要再次的修改。BootLoader在上个博客中完成了编译实际上没有调整对外设的设置还需要启动相关的外设。一、Boot的参数设置以及代码添加我们查看通讯初始化的代码可以发现其Bootloader的升级通讯外设有多种。/************************************************************************************//** ** \brief Initializes the communication module including the hardware needed for ** the communication. ** \return none ** ****************************************************************************************/ void ComInit(void) { /* initialize the XCP communication protocol */ XcpInit(); #if (BOOT_COM_CAN_ENABLE 0) /* initialize the CAN controller */ CanInit(); /* set it as active */ comActiveInterface COM_IF_CAN; #endif #if (BOOT_COM_RS232_ENABLE 0) /* initialize the RS232 interface */ Rs232Init(); /* set it as active */ comActiveInterface COM_IF_RS232; #endif #if (BOOT_COM_MBRTU_ENABLE 0) /* initialize the Modbus RTU interface */ MbRtuInit(); /* set it as active */ comActiveInterface COM_IF_MBRTU; #endif #if (BOOT_COM_USB_ENABLE 0) /* initialize the USB interface */ UsbInit(); /* set it as active */ comActiveInterface COM_IF_USB; #endif #if (BOOT_COM_NET_ENABLE 0) #if (BOOT_COM_NET_DEFERRED_INIT_ENABLE 0) /* initialize the TCP/IP interface */ NetInit(); /* set it as active */ comActiveInterface COM_IF_NET; #endif #endif } /*** end of ComInit ***/我们初步选择MbRtumodbus协议来作为升级的协议。同时要注意我们开启了uart的外设还需要使能他的中断。/* USER CODE BEGIN USART1_Init 2 */ LL_USART_EnableIT_RXNE(USART1); /* USER CODE END USART1_Init 2 */根据 官网的教程手册 我们添加以下的代码进入程序。manual:modbus_rtu_demo [OpenBLT Bootloader]https://www.feaser.com/openblt/doku.php?idmanual:modbus_rtu_demo代码如下/** \brief Enable/disable RS485 transport layer. */ #define BOOT_COM_MBRTU_ENABLE (1) /** \brief Configure the desired communication speed. */ #define BOOT_COM_MBRTU_BAUDRATE (57600) /** \brief Configure the desired number of stopbits (1 or 2). */ #define BOOT_COM_MBRTU_STOPBITS (1) /** \brief Configure the desired parity (0 for none, 1 for odd, 2 for even). */ #define BOOT_COM_MBRTU_PARITY (2) /** \brief Configure number of bytes in the target-host data packet. */ #define BOOT_COM_MBRTU_TX_MAX_DATA (129) /** \brief Configure number of bytes in the host-target data packet. */ #define BOOT_COM_MBRTU_RX_MAX_DATA (129) /** \brief Select the desired UART peripheral as a zero based index. */ #define BOOT_COM_MBRTU_CHANNEL_INDEX (1) /** \brief The 8-bit node identifier of this node. Should be between 1 and 247. */ #define BOOT_COM_MBRTU_NODE_ID (1) //用于定义MBRTU的初始化以及地址参数等信息。 /************************************************************************************//** ** \brief Controls the state of the DE/NRE GPIO pin on an RS485 transceiver. ** \param enable When enable is BLT_TRUE, the pin should go logic high to enable the ** driver output. When enable is BLT_FALSE, the pin should go logic low to ** enable the receiver input. ** \return none. ** ****************************************************************************************/ void MbRtuDriverOutputControlHook(blt_bool enable) { /* Should the driver output be enabled (transmit)? */ if (enable BLT_TRUE) { /* TODO If needed, set DE and NRE pins to high to enable the driver output. */ } /* The receiver output should be enabled (receive). */ else { /* TODO If needed, set DE and NRE pins to low to enable the receiver input. */ } } /*** end of MbRtuDriverOutputControlHook ***/ //驱动输出控制钩子函数根据自己的需要更改初始化的宏定义。就完成了Boot程序的编写。二、App的代码添加与程序设置我们在设计OTA的时候要先规划boot程序和app程序的分区地址定义。我们初步设置boot占用的空间为0x4000于是从地址为0x0800 0000开始到0x0800 3FFF为boot的存储地址app则是从地址为0x0800 4000开始。我们要同步设置boot和app的keil工程设置如图bootapp同时修改 app的system.c文件中的中断向量表地址的偏移地址和我们的项目设置的启始地址一致。#if 1 #define USER_VECT_TAB_ADDRESS #endif #if defined(USER_VECT_TAB_ADDRESS) /*! Uncomment the following line if you need to relocate your vector Table in Sram else user remap will be done in Flash. */ /* #define VECT_TAB_SRAM */ #if defined(VECT_TAB_SRAM) #define VECT_TAB_BASE_ADDRESS SRAM_BASE /*! Vector Table base address field. This value must be a multiple of 0x200. */ #define VECT_TAB_OFFSET 0x00000000U /*! Vector Table base offset field. This value must be a multiple of 0x200. */ #else #define VECT_TAB_BASE_ADDRESS FLASH_BASE /*! Vector Table base address field. This value must be a multiple of 0x200. */ #define VECT_TAB_OFFSET 0x00004000U /*! Vector Table base offset field. This value must be a multiple of 0x200. */ #endif /* VECT_TAB_SRAM */ #endif /* USER_VECT_TAB_ADDRESS */再修改boot程序中的flash_layout.c中的存储地址分配数组static const tFlashSector flashLayout[] { /* space is reserved for a bootloader configuration with all supported communication * interfaces enabled. when for example only UART is needed, than the space required * for the bootloader can be made a lot smaller here. */ /* { 0x08000000, 0x02000 }, flash sector 0 - reserved for bootloader */ //{ 0x08002000, 0x02000 }, /* flash sector 1 - 8kb */ { 0x08004000, 0x02000 }, /* flash sector 2 - 8kb */ { 0x08006000, 0x02000 }, /* flash sector 3 - 8kb */ { 0x08008000, 0x02000 }, /* flash sector 4 - 8kb */ { 0x0800A000, 0x02000 }, /* flash sector 5 - 8kb */ { 0x0800C000, 0x02000 }, /* flash sector 6 - 8kb */ { 0x0800E000, 0x02000 }, /* flash sector 7 - 8kb */ { 0x08010000, 0x02000 }, /* flash sector 8 - 8kb */ { 0x08012000, 0x02000 }, /* flash sector 9 - 8kb */ { 0x08014000, 0x02000 }, /* flash sector 10 - 8kb */ { 0x08016000, 0x02000 }, /* flash sector 11 - 8kb */ { 0x08018000, 0x02000 }, /* flash sector 12 - 8kb */ { 0x0801A000, 0x02000 }, /* flash sector 13 - 8kb */ { 0x0801C000, 0x02000 }, /* flash sector 14 - 8kb */ { 0x0801E000, 0x02000 }, /* flash sector 15 - 8kb */ };就完成所有的操作接下来就可以使用Host的上位机程序来烧录app的srec程序了。要注意app的代码调用这个函数即可但是要注意该任务的运行频率建议放在中断中或者最高优先级。BootComCheckActivationRequest();三、总结其实这些设置无非就是开启外设和设置地址分配的相关代码。总体来说这个开源的OpenBLT还是很方便的一致性也高。个人的成功demo可见资源下载。仅供参考。

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询