Bootloader fixes and updates

- Add canary value for bootloader entry
- Fix initial GPIO config for this application
This commit is contained in:
true
2023-11-12 16:59:53 -08:00
parent 60bd8d88b7
commit 00e0dcecf3
16 changed files with 391 additions and 161 deletions

View File

@@ -33,8 +33,13 @@ typedef enum {
extern uint32_t bootcheck;
BL_flash_status flash_erase_page(uint32_t addr);
BL_flash_status flash_write(uint32_t addr, uint8_t *data, uint16_t length);
void jump_to_user_app();

View File

@@ -64,7 +64,7 @@
//#include "hk32f030m_i2c.h"
//#include "hk32f030m_iwdg.h"
#include "hk32f030m_pwr.h"
//#include "hk32f030m_spi.h"
#include "hk32f030m_spi.h"
//#include "hk32f030m_tim.h"
#include "hk32f030m_usart.h"
//#include "hk32f030m_iwdg.h"

View File

@@ -0,0 +1,47 @@
/*
* sk_led.h
*
* Created on: Jul 17, 2023
* Author: true
*/
#ifndef CODE_INC_LED_SK_H_
#define CODE_INC_LED_SK_H_
#include <stdint.h>
#include "hk32f030m.h"
#define SK6X_PORT GPIOD
#define SK6X_PIN (1 << 4)
#define SK6X_LED_COUNT 5
#ifdef USE_SK_LEDS
void led_init();
void led_set(uint8_t idx, uint8_t r, uint8_t g, uint8_t b);
void led_set_all(uint8_t r, uint8_t g, uint8_t b);
void led_tx();
#else
#define led_init()
#define led_set(i, r, g, b)
#define led_set_all(r, g, b)
#define led_tx()
#endif
#endif /* CODE_INC_LED_SK_H_ */

View File

@@ -28,7 +28,6 @@
void user_io_init();
void user_led_init();

View File

@@ -64,12 +64,13 @@
/* Status report for the functions. */
typedef enum {
X_OK = 0x00u, /**< The action was successful. */
X_ERROR_CRC = 0x01u, /**< CRC calculation error. */
X_ERROR_NUMBER = 0x02u, /**< Packet number mismatch error. */
X_ERROR_UART = 0x04u, /**< UART communication error. */
X_ERROR_FLASH = 0x08u, /**< Flash related error. */
X_ERROR = 0xFFu /**< Generic error. */
X_OK = 0x00u, /**< The action was successful. */
X_ERROR_CRC = 0x01u, /**< CRC calculation error. */
X_ERROR_NUMBER = 0x02u, /**< Packet number mismatch error. */
X_ERROR_UART = 0x04u, /**< UART communication error. */
X_ERROR_FLASH = 0x08u, /**< Flash related error. */
X_TIMEOUT = 0xfe,
X_ERROR = 0xFFu /**< Generic error. */
} BL_xmodem_status;