lriot 2.1.0.0
lr1110_bootloader.h File Reference

Bootloader driver definition for LR1110. More...

Go to the source code of this file.

Typedefs

typedef uint32_t lr1110_bootloader_irq_mask_t
 

Functions

err_t lr1110_bootloader_get_status (lriot_t *ctx, lr1110_bootloader_stat1_t *stat1, lr1110_bootloader_stat2_t *stat2, lr1110_bootloader_irq_mask_t *irq_status)
 Return the status registers and interrupt flags.
 
err_t lr1110_bootloader_clear_reset_status_info (lriot_t *ctx)
 Clear the reset status information stored in stat2.
 
err_t lr1110_bootloader_get_version (lriot_t *ctx, lr1110_bootloader_version_t *version)
 Return the version of the system (hardware and software)
 
err_t lr1110_bootloader_erase_flash (lriot_t *ctx)
 Erase the whole flash memory of the chip.
 
err_t lr1110_bootloader_write_flash_encrypted (lriot_t *ctx, uint32_t offset, const uint32_t *buffer, uint8_t length)
 Write encrypted data in program flash memory of the chip.
 
err_t lr1110_bootloader_write_flash_encrypted_full (lriot_t *ctx, uint32_t offset, const uint32_t *buffer, uint32_t length)
 Write encrypted data in program flash memory of the chip.
 
err_t lr1110_bootloader_reboot (lriot_t *ctx, bool stay_in_bootloader)
 Software reset of the chip.
 
err_t lr1110_bootloader_read_pin (lriot_t *ctx, lr1110_bootloader_pin_t pin)
 Returns the 4-byte PIN which can be used to claim a device on cloud services.
 
err_t lr1110_bootloader_read_chip_eui (lriot_t *ctx, lr1110_bootloader_chip_eui_t chip_eui)
 Read and return the Chip EUI.
 
err_t lr1110_bootloader_read_join_eui (lriot_t *ctx, lr1110_bootloader_join_eui_t join_eui)
 Read and return the Join EUI.
 

Detailed Description

Bootloader driver definition for LR1110.

The Clear BSD License Copyright Semtech Corporation 2021. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the Semtech corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Typedef Documentation

◆ lr1110_bootloader_irq_mask_t

typedef uint32_t lr1110_bootloader_irq_mask_t

Function Documentation

◆ lr1110_bootloader_clear_reset_status_info()

err_t lr1110_bootloader_clear_reset_status_info ( lriot_t * ctx)

Clear the reset status information stored in stat2.

Parameters
[in]ctxChip implementation context
Returns
Operation status

◆ lr1110_bootloader_erase_flash()

err_t lr1110_bootloader_erase_flash ( lriot_t * ctx)

Erase the whole flash memory of the chip.

This function shall be called before any attempt to write a new firmware in flash memory

Parameters
[in]ctxChip implementation context
Returns
Operation status

◆ lr1110_bootloader_get_status()

err_t lr1110_bootloader_get_status ( lriot_t * ctx,
lr1110_bootloader_stat1_t * stat1,
lr1110_bootloader_stat2_t * stat2,
lr1110_bootloader_irq_mask_t * irq_status )

Return the status registers and interrupt flags.

Remarks
To simplify system integration, this function does not actually execute the GetStatus command, which would require bidirectional SPI communication. It obtains the stat1, stat2, and irq_status values by performing an ordinary SPI read (which is required to send null/NOP bytes on the MOSI line). This is possible since the LR1110 returns these values automatically whenever a read that does not directly follow a response-carrying command is performed. Unlike with the GetStatus command, however, the reset status information is NOT cleared by this command. The function lr1110_bootloader_clear_reset_status_info may be used for this purpose when necessary.
Parameters
[in]ctxChip implementation context
[out]stat1Content of status register 1
[out]stat2Content of status register 2
[out]irq_statusInterrupt flags
Returns
Operation status

◆ lr1110_bootloader_get_version()

err_t lr1110_bootloader_get_version ( lriot_t * ctx,
lr1110_bootloader_version_t * version )

Return the version of the system (hardware and software)

Parameters
[in]ctxChip implementation context
[out]versionPointer to the structure holding the system version
Returns
Operation status

◆ lr1110_bootloader_read_chip_eui()

err_t lr1110_bootloader_read_chip_eui ( lriot_t * ctx,
lr1110_bootloader_chip_eui_t chip_eui )

Read and return the Chip EUI.

Parameters
[in]ctxChip implementation context
[out]chip_euiThe buffer to be filled with chip EUI of the LR1110. It is up to the application to ensure chip_eui is long enough to hold the chip EUI
Returns
Operation status

◆ lr1110_bootloader_read_join_eui()

err_t lr1110_bootloader_read_join_eui ( lriot_t * ctx,
lr1110_bootloader_join_eui_t join_eui )

Read and return the Join EUI.

Parameters
[in]ctxChip implementation context
[out]join_euiThe buffer to be filled with Join EUI of the LR1110. It is up to the application to ensure join_eui is long enough to hold the join EUI
Returns
Operation status

◆ lr1110_bootloader_read_pin()

err_t lr1110_bootloader_read_pin ( lriot_t * ctx,
lr1110_bootloader_pin_t pin )

Returns the 4-byte PIN which can be used to claim a device on cloud services.

Parameters
[in]ctxChip implementation context
[out]pinPointer to the array to be populated with the PIN
Returns
Operation status

◆ lr1110_bootloader_reboot()

err_t lr1110_bootloader_reboot ( lriot_t * ctx,
bool stay_in_bootloader )

Software reset of the chip.

This method should be used to reboot the chip in a specified mode. Rebooting in flash mode presumes that the content in flash memory is not corrupted (i.e. the integrity check performed by the bootloader before executing the first instruction in flash is OK).

Parameters
[in]ctxChip implementation context
[in]stay_in_bootloaderSelector to stay in bootloader or execute flash code after reboot. If true, the bootloader will not execute the flash code but activate SPI interface to allow firmware upgrade
Returns
Operation status

◆ lr1110_bootloader_write_flash_encrypted()

err_t lr1110_bootloader_write_flash_encrypted ( lriot_t * ctx,
uint32_t offset,
const uint32_t * buffer,
uint8_t length )

Write encrypted data in program flash memory of the chip.

This function shall be used when updating the encrypted flash content of the LR1110. The encrypted flash payload to transfer shall be represented as an array of words (i.e. 4-byte values).

Parameters
[in]ctxChip implementation context
[in]offsetThe offset from start register of flash
[in]bufferBuffer holding the encrypted content. Its size in words must be at least length
[in]lengthNumber of words (i.e. 4 bytes) in the buffer to transfer
Returns
Operation status

◆ lr1110_bootloader_write_flash_encrypted_full()

err_t lr1110_bootloader_write_flash_encrypted_full ( lriot_t * ctx,
uint32_t offset,
const uint32_t * buffer,
uint32_t length )

Write encrypted data in program flash memory of the chip.

This function shall be used when updating the encrypted flash content of the LR1110. The encrypted flash payload to transfer shall be represented as an array of words (ie 4-byte values).

Parameters
[in]ctxChip implementation context
[in]offsetThe offset from start register of flash
[in]bufferBuffer holding the encrypted content. Its size in words must be at least length
[in]lengthNumber of words (i.e. 4 bytes) in the buffer to transfer
Returns
Operation status