简体   繁体   English

STM32通过以太网上传应用程序/软件

[英]STM32 uploading application/software over ethernet

Is there a way for uploading applications to an STM32 board over the ethernet? 是否可以通过以太网将应用程序上传到STM32板上?

I need to be able to upload code on ~200 Nucleo F429ZI boards that are only connected together with a PC via a LAN. 我需要能够在大约200个通过LAN仅与PC连接在一起的Nucleo F429ZI板上上传代码。

You can find example codes for STM324xG_EVAL and STM324x9I_EVAL board on STMCubeF4 under LWIP_IAP folder and you can follow the documents UM1709 and AN3968. 你可以找到关于STM324xG_EVAL和STM324x9I_EVAL板例如代码STMCubeF4 LWIP_IAP文件夹下,你可以按照文件UM1709和AN3968。 You should adapt example codes according to your board. 您应根据自己的电路板改编示例代码。

I have not used LwIP_IAP - as noted by Gürtaç Kadem - but it seems like the easiest solution. 正如GürtaçKadem所述,我还没有使用LwIP_IAP,但这似乎是最简单的解决方案。

Another way (also applicable to non-ST boards, in case someone else wanders to this question) would be to add the mbed bootloader to your project. 另一种方法(如果有人怀疑这个问题,也适用于非ST板)是将mbed引导加载程序添加到您的项目中。 Then run a TCP server on your board, let the PC connect to the board and write the new application to the board. 然后在您的板上运行一个TCP服务器 ,让PC连接到板上并将新的应用程序写入板上。 Store the new binary in flash, and the bootloader can then load the new binary on reboot. 将新的二进制文件存储在闪存中,然后引导加载程序可以在重新引导时加载新的二进制文件。

Requires a bit of coding though. 不过需要一些编码。 Also you'd need to add a trust relationship between computer and board, perhaps by signing the new binary with a private key and holding the public key on the board. 另外,您可能需要在计算机和主板之间添加信任关系,这可能是通过用私钥对新二进制文件进行签名并在主板上持有公钥来实现的。 mbed TLS is capable of this (fe via X509). mbed TLS可以做到这一点(通过X509)。

I project I did in the past had the following setup. 我计划过去所做的项目具有以下设置。

  • One external flash 一个外接闪光灯
  • Boot-loader (first STM32 project in my IDE), doing the following each boot-up 引导程序(我的IDE中的第一个STM32项目),每次引导时都进行以下操作
    • Is there a new image in the external flash? 外置闪光灯中是否有新图像? I even added a RSA signature to this step 我什至在此步骤中添加了RSA签名
    • If image verifies OK, erase STM32-flash except the first 64K which has the boot-loader, and rewrite it using data from the external flash. 如果图像验证正常,则擦除除具有引导加载程序的前64K以外的STM32闪存,然后使用外部闪存中的数据将其重写。 And clear the first sector in the external flash when done to avoid reflashing the STM32 at every boot 并在完成后清除外部闪存中的第一个扇区,以避免每次引导时重新刷新STM32
    • Jump into the payload 跳入有效载荷
  • Payload (second STM32 project in my IDE). 有效负载(我的IDE中的第二个STM32项目)。 I configured my IDE to place the image 64K into the flash of the STM32. 我将IDE配置为将图像64K放入STM32的闪存中。 My payload uses LwIP as its IP-stack (git latest, and grabbed the hardware glue-code needed from another STM32 example) 我的有效负载使用LwIP作为其IP堆栈(最新git,并从另一个STM32示例中获取了所需的硬件粘合代码)
  • Made a small tool that can read the .hex file that my IDE generates, sign it with my RSA key, and output a file that my control-software understands and can transmit to my STM32 when it is operating in its normal mode. 制作了一个小型工具,可以读取我的IDE生成的.hex文件,用我的RSA密钥对其进行签名,并输出一个控制软件可以理解的文件,并在正常模式下运行时可以将其传输到STM32。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM