July 2010 Doc ID 17570 Rev 1 1/18
AN3226
Application note
STM32F107 In-Application Programming (IAP) over Ethernet
Introduction
This application note is intended for developers using the STM32F107 microcontroller. It
provides implementation solutions for In-Application Programming (IAP) using the
STM32F107 Ethernet communications interface.
Two possible solutions are provided on top of the LwIP TCP/IP stack:
IAP using TFTP (Trivial File Transfer Protocol)
IAP using HTTP (Hypertext Transfer Protocol)
www.st.com
Contents AN3226
2/18 Doc ID 17570 Rev 1
Contents
1 IAP overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1 Theory of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 IAP using the MCU’s Ethernet interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Implementing IAP over Ethernet on the STM32F107 . . . . . . . . . . . . . . . . . 4
1.3.1 IAP method using TFTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3.2 IAP method using HTTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 IAP using TFTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1 TFTP overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Implementing IAP for the STM32F107 using TFTP . . . . . . . . . . . . . . . . . . 6
2.3 Using the software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3 IAP using HTTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1 HTTP file upload overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Implementing IAP using HTTP on the STM32F107 . . . . . . . . . . . . . . . . . 11
3.3 Using the software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.4 Known limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.4.1 Extra bytes added to binary file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4 Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.1 MAC and IP address settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.2 Jumper settings on the STM3210C_EVAL board . . . . . . . . . . . . . . . . . . . 14
4.3 Software file organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.4 Code size measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.5 Building an image for IAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17