# Efficient Runtime Firmware Update Mechanism for LoRaWAN Class A Devices
###### Abstract  
This paper presents an efficient and secure method for updating firmware in IoT devices using LoRaWAN network resources and communication protocols. The proposed method involves dividing the firmware into fragments, storing them in the application server's database, and transmitting them to remote IoT devices via downlink messages, without necessitating any changes to the device's class. This approach can be replicated across any IoT LoRaWAN device, offering a robust and scalable solution for large-scale firmware updates while ensuring data security and integrity. The proposed method significantly reduces the downtime of IoT devices and enhances the energy efficiency of the update process. The method was validated by updating a block in the program memory, associated to a specific functionality of the IoT end device. The associated Intel Hex file was segmented into 17 LoRaWAN downlink frames with an average size of 46 bytes. Upon receiving the complete firmware update, the microcontroller employs self-programming techniques that restrict the update process to specific rows of the program memory, avoiding interruptions or reboots. The update process was successfully completed in 51.33 ms, resulting in a downtime of 16.88 ms. This method demonstrates improved energy efficiency compared to existing solutions while preserving the communication network's capacity, making it an adequate solution for remote devices in LoRaWAN networks. firmware update; partial update; internet of things; LoRaWAN; microcontrollers +
Footnote †: journal: _eng_  
0000-0001-9300-0001-9300-0000][PERSON]  
0000-0001-9300-000  
devices using low-power networks compared to cellular and wireless networks. This work emphasizes the critical role of firmware updates in maintaining the security and functionality of IoT devices and the difficulties associated with transmitting large data volumes over low-power networks. Another pertinent study by [PERSON] [2] proposes the usage of multicast messages to facilitate efficient and secure firmware updates over LoRaWAN networks. The author advocates the division of the update process into multiple stages, such as signature verification and update status monitoring, to minimize energy consumption and transmission time. However, this method encounters significant challenges due to the high packet loss rate inherent in LoRaWAN networks. The analysis of related work reveals that most studies involve transmitting the entire program memory image in small fragments. Consequently, a substantial volume of available memory in IoT devices is required to successfully execute the firmware update process, as it necessitates locally reconstructing the firmware image and maintaining a backup code copy. The downtime during the update process is also considerable, typically lasting several minutes. Additionally, significant attention is given to the security of firmware updates, with two primary research areas identified: management mechanisms and security mechanisms for firmware updates over LoRaWAN networks. This article presents an innovative method for firmware updates in IoT devices using LoRaWAN networks, focusing on transmitting only the program instructions that need modification or addition. This approach addresses several limitations and challenges identified in previous research, particularly remote firmware updates with minimal service interruption. The proposed approach represents a paradigm shift in firmware updates for IoT devices. Unlike multicast transmission models, our method enables peer-to-peer firmware updates at the application layer of IoT devices, significantly reducing radio transmission usage. This approach offers several advantages: it eliminates the need to reconstruct firmware images on the devices, removes the necessity for bootloders, and ensures efficient use of available flash memory and communication resources. Additionally, it significantly reduces downtime, making the system simpler and more accessible.