8000 mimxrt/bootloader: Rename to mboot. · micropython/micropython@29e5c39 · GitHub
[go: up one dir, main page]

Skip to content

Commit 29e5c39

Browse files
committed
mimxrt/bootloader: Rename to mboot.
1 parent 50b2368 commit 29e5c39

32 files changed

+186
-186
lines changed

ports/mimxrt/Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BOARD ?= TEENSY40
22
BOARD_DIR ?= boards/$(BOARD)
3-
BOOTLOADER_DIR ?= bootloader
3+
BOOTLOADER_DIR ?= mboot
44
BUILD ?= build-$(BOARD)
55

66
PORT ?= /dev/ttyACM0
@@ -57,7 +57,7 @@ MCU_DIR = lib/nxp_driver/sdk/devices/$(MCU_SERIES)
5757
LD_FILES = boards/common.ld
5858

5959
MAKE_PINS = boards/make-pins.py
60-
PATCH_BINARY = bootloader/tools/patch-binary.py
60+
PATCH_BINARY = mboot/tools/patch-binary.py
6161
MAKE_FLEXRAM_LD = boards/make-flexram-config.py
6262
BOARD_PINS = $(BOARD_DIR)/pins.csv
6363
AF_FILE = boards/$(MCU_SERIES)_af.csv
@@ -115,7 +115,7 @@ CFLAGS_DEFINES_COMMON += \
115115

116116
CFLAGS_DEFINES_FW += \
117117
-DBOARD_FLASH_SIZE=$(MICROPY_HW_FLASH_SIZE) \
118-
-DMICROPY_BOOTLOADER_BINARY='"$(BUILD_BL)/bootloader.bin"'
118+
-DMICROPY_BOOTLOADER_BINARY='"$(BUILD_BL)/mboot.bin"'
119119

120120
CFLAGS += \
121121
$(CFLAGS_COMMON) \
@@ -452,7 +452,7 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_SS:.S=.o))
452452
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
453453
OBJ += $(BUILD)/pins_gen.o
454454

455-
include bootloader.mk
455+
include mboot.mk
456456

457457
# Workaround for bug in older gcc, warning on "static usbd_device_t _usbd_dev = { 0 };"
458458
$(BUILD)/lib/tinyusb/src/device/usbd.o: CFLAGS += -Wno-missing-braces
@@ -471,9 +471,9 @@ $(BUILD)/firmware.elf: $(OBJ)
471471
$(Q)$(OBJCOPY) $@ --update-section .fw_header=$(BUILD)/fw_header.bin
472472
$(ECHO) "$(BUILD)/fw_header.bin ==> .fw_header"
473473
$(ECHO) ""
474-
$(ECHO) "UPDATE SECTION .bootloader"
475-
$(Q)$(OBJCOPY) $@ --update-section .bootloader=$(BUILD_BL)/bootloader.bin
476-
$(ECHO) "$(BUILD_BL)/bootloader.bin ==> .bootloader"
474+
$(ECHO) "UPDATE SECTION .mboot"
475+
$(Q)$(OBJCOPY) $@ --update-section .mboot=$(BUILD_BL)/mboot.bin
476+
$(ECHO) "$(BUILD_BL)/mboot.bin ==> .mboot"
477477
$(ECHO) ""
478478
$(ECHO) "OUTPUT INFO"
479479
$(Q)$(SIZE) $@
@@ -490,7 +490,7 @@ $(BUILD)/firmware.hex: $(BUILD)/firmware.elf
490490
# any of the objects. The normal dependency generation will deal with the
491491
# case when pins.h is modified. But when it doesn't exist, we don't know
492492
# which source files might need it.
493-
$(OBJ): | $(BUILD_BL)/bootloader.bin $(BUILD_BL)/bootloader.hex $(GEN_PINS_HDR) $(GEN_FLEXRAM_CONFIG_SRC)
493+
$(OBJ): | $(BUILD_BL)/mboot.bin $(BUILD_BL)/mboot.hex $(GEN_PINS_HDR) $(GEN_FLEXRAM_CONFIG_SRC)
494494

495495
# With conditional pins, we may need to regenerate qstrdefs.h when config
496496
# options change.

ports/mimxrt/boards/common.ld

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ ENTRY(Reset_Handler)
4444
flash_config_start = DEFINED(flash_config_start) ? flash_config_start : flash_start;
4545
flash_config_size = DEFINED(flash_config_size) ? flash_config_size : 0x00001000;
4646

47-
bootloader_start = flash_config_start;
47+
mboot_start = flash_config_start;
4848
#if MICROPY_HW_FLASH_TYPE == qspi_nor
49-
bootloader_size = MICROPY_HW_FLASH_FIRMWARE_START_ADDR - (flash_config_start - flash_start);
49+
mboot_size = MICROPY_HW_FLASH_FIRMWARE_START_ADDR - (flash_config_start - flash_start);
5050
#elif MICROPY_HW_FLASH_TYPE == hyperflash
51-
bootloader_size = MICROPY_HW_FLASH_FIRMWARE_START_ADDR - (flash_config_start - flash_start);
51+
mboot_size = MICROPY_HW_FLASH_FIRMWARE_START_ADDR - (flash_config_start - flash_start);
5252
#else
5353
#error Unknown MICROPY_HW_FLASH_TYPE
5454
#endif
55-
firmware_start = bootloader_start + bootloader_size;
55+
firmware_start = mboot_start + mboot_size;
5656
firmware_size = flash_end - firmware_start;
5757

5858
ivt_start = flash_config_start + flash_config_size;
@@ -89,7 +89,7 @@ STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
8989
/* Specify the memory areas */
9090
MEMORY
9191
{
92-
m_bootloader (RX) : ORIGIN = flash_config_start, LENGTH = bootloader_size
92+
m_mboot (RX) : ORIGIN = flash_config_start, LENGTH = mboot_size
9393
/* --- */
9494
m_fw_header (RX) : ORIGIN = fw_header_start, LENGTH = fw_header_size
9595
m_interrupts (RX) : ORIGIN = interrupts_start, LENGTH = interrupts_size
@@ -116,19 +116,19 @@ SECTIONS
116116
__sdram_start = sdram_start;
117117
#endif
118118

119-
.bootloader :
119+
.mboot :
120120
{
121121
FILL(0x00);
122122
. = ALIGN(4);
123123
__FLASH_BASE = .;
124124
KEEP(* (.boot_hdr.conf)) /* flash config section */
125-
. = ORIGIN(m_bootloader) + flash_config_size;
125+
. = ORIGIN(m_mboot) + flash_config_size;
126126
KEEP(* (.boot_hdr.ivt)) /* ivt section */
127127
KEEP(* (.boot_hdr.boot_data)) /* boot section */
128128
KEEP(* (.boot_hdr.dcd_data)) /* dcd section */
129-
. = ORIGIN(m_bootloader) + LENGTH(m_bootloader) - 1;
129+
. = ORIGIN(m_mboot) + LENGTH(m_mboot) - 1;
130130
BYTE(0x00)
131-
} > m_bootloader
131+
} > m_mboot
132132

133133
. = ORIGIN(m_fw_header);
134134
.fw_header :

ports/mimxrt/bootloader.mk renamed to ports/mimxrt/mboot.mk

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
BUILD_BL ?= build-$(BOARD)/bootloader
1+
BUILD_BL ?= build-$(BOARD)/mboot
22
LD_FILES_BL = $(BOOTLOADER_DIR)/boards/common.ld
33

44
INC_TINYUSB_BL += \
@@ -40,12 +40,12 @@ SRC_TINYUSB_C_BL += \
4040
lib/tinyusb/src/tusb.c
4141

4242
SRC_C_BL += \
43-
$(BOOTLOADER_DIR)/boards/flexspi_nor_boot.c \
44-
$(BOOTLOADER_DIR)/boot_buffer.c \
45-
$(BOOTLOADER_DIR)/boot_dfu.c \
46-
$(BOOTLOADER_DIR)/boot_utils.c \
47-
$(BOOTLOADER_DIR)/boot_upgrade.c \
48-
$(BOOTLOADER_DIR)/boot_validate.c \
< 10000 /code>43+
$(BOOTLOADER_DIR)/boards/flexspi_nor_mboot.c \
44+
$(BOOTLOADER_DIR)/mboot_buffer.c \
45+
$(BOOTLOADER_DIR)/mboot_dfu.c \
46+
$(BOOTLOADER_DIR)/mboot_utils.c \
47+
$(BOOTLOADER_DIR)/mboot_upgrade.c \
48+
$(BOOTLOADER_DIR)/mboot_validate.c \
4949
$(BOOTLOADER_DIR)/main.c \
5050
$(BOOTLOADER_DIR)/tusb_port.c \
5151
$(SRC_C_COMMON) \
@@ -54,7 +54,7 @@ SRC_C_BL += \
5454

5555
SRC_SS_BL = \
5656
$(MCU_DIR)/gcc/startup_$(MCU_SERIES).S \
57-
$(BOOTLOADER_DIR)/hal/resethandler_bootloader_MIMXRT10xx_RAM.S
57+
$(BOOTLOADER_DIR)/hal/resethandler_mboot_MIMXRT10xx_RAM.S
5858

5959
# Flags
6060
CFLAGS_DEFINES_BL += \
@@ -107,12 +107,12 @@ $(Q)$(CC) $(CFLAGS_BL) -c -MD -o $@ $<
107107
endef
108108

109109
# Targets
110-
bootloader_all: $(BUILD_BL)/bootloader.bin $(BUILD_BL)/bootloader.hex $(BUILD_BL)/bootloader.hex bootloader_info
111-
.PHONY: bootloader_all
110+
mboot_all: $(BUILD_BL)/mboot.bin $(BUILD_BL)/mboot.hex $(BUILD_BL)/mboot.hex mboot_info
111+
.PHONY: mboot_all
112112

113-
bootloader_clean:
113+
mboot_clean:
114114
$(RM) -rf $(BUILD_BL)
115-
.PHONY: bootloader_clean
115+
.PHONY: mboot_clean
116116

117117
OBJ_DIRS_BL = $(sort $(dir $(OBJ_BL)))
118118
$(OBJ_BL): | $(OBJ_DIRS_BL)
@@ -137,44 +137,44 @@ $(BUILD_BL)/%.pp: %.c
137137
$(ECHO) "PreProcess $<"
138138
$(Q)$(CPP) $(CFLAGS_BL) -Wp,-C,-dD,-dI -o $@ $<
139139

140-
$(BUILD_BL)/bootloader.elf: $(OBJ_BL)
140+
$(BUILD_BL)/mboot.elf: $(OBJ_BL)
141141
$(ECHO) $(LINK_MSG)
142142
$(ECHO) "PREPROCESS LINK $@"
143143
$(Q)$(CC) -E -x c $(LDDEFINES_BL) $(LD_FILES_BL) | grep -v '^#' > $(BUILD_BL)/link.ld
144144
$(ECHO) "LINK $@"
145145
$(Q)$(CC) $(addprefix -T, $(BUILD_BL)/link.ld) $(LDFLAGS_BL) -o $@ $^ $(LIBS_BL)
146146

147-
$(BUILD_BL)/bootloader.bin: $(BUILD_BL)/bootloader.elf
147+
$(BUILD_BL)/mboot.bin: $(BUILD_BL)/mboot.elf
148148
$(Q)$(OBJCOPY) -O binary $^ $@
149149

150-
$(BUILD_BL)/bootloader.hex: $(BUILD_BL)/bootloader.elf
150+
$(BUILD_BL)/mboot.hex: $(BUILD_BL)/mboot.elf
151151
$(Q)$(OBJCOPY) -O ihex $^ $@
152152

153-
bootloader_info: $(BUILD_BL)/bootloader.elf $(BUILD_BL)/bootloader.bin
153+
mboot_info: $(BUILD_BL)/mboot.elf $(BUILD_BL)/mboot.bin
154154
$(ECHO) "Bootloader Info"
155155
$(ECHO) "Download buffer $(MICROPY_BOOT_BUFFER_SIZE)"
156-
$(Q)$(SIZE) $(BUILD_BL)/bootloader.elf
157-
$(Q)$(SIZE) $(BUILD_BL)/bootloader.bin --target binary
156+
$(Q)$(SIZE) $(BUILD_BL)/mboot.elf
157+
$(Q)$(SIZE) $(BUILD_BL)/mboot.bin --target binary
158158

159-
BL_JLINK_COMMANDER_SCRIPT = $(BUILD_BL)/script_bootloader.jlink
159+
BL_JLINK_COMMANDER_SCRIPT = $(BUILD_BL)/script_mboot.jlink
160160

161161
ifdef JLINK_IP
162162
BL_JLINK_CONNECTION_SETTINGS = -IP $(JLINK_IP)
163163
else
164164
BL_JLINK_CONNECTION_SETTINGS = -USB
165165
endif
166166

167-
bootloader_deploy_jlink: $(BUILD_BL)/bootloader.hex
167+
mboot_deploy_jlink: $(BUILD_BL)/mboot.hex
168168
$(Q)$(TOUCH) $(BL_JLINK_COMMANDER_SCRIPT)
169169
$(ECHO) "ExitOnError 1" > $(BL_JLINK_COMMANDER_SCRIPT)
170170
$(ECHO) "speed auto" >> $(BL_JLINK_COMMANDER_SCRIPT)
171171
$(ECHO) "r" >> $(BL_JLINK_COMMANDER_SCRIPT)
172172
$(ECHO) "st" >> $(BL_JLINK_COMMANDER_SCRIPT)
173-
$(ECHO) "loadfile \"$(realpath $(BUILD_BL)/bootloader.hex)\"" >> $(BL_JLINK_COMMANDER_SCRIPT)
173+
$(ECHO) "loadfile \"$(realpath $(BUILD_BL)/mboot.hex)\"" >> $(BL_JLINK_COMMANDER_SCRIPT)
174174
$(ECHO) "qc" >> $(BL_JLINK_COMMANDER_SCRIPT)
175175
$(JLINK_PATH)JLinkExe -device $(MCU_VARIANT) -if SWD $(BL_JLINK_CONNECTION_SETTINGS) -CommanderScript $(BL_JLINK_COMMANDER_SCRIPT)
176176

177177

178178

179-
.PHONY: bootloader_info
180-
.PHONY: bootloader_deploy_jlink
179+
.PHONY: mboot_info
180+
.PHONY: mboot_deploy_jlink

ports/mimxrt/bootloader/README.md renamed to ports/mimxrt/mboot/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## QSPI
44
```
55
+--------------+
6-
0x6000'0000 | bootloader |
6+
0x6000'0000 | mboot |
77
| |
88
+--------------+
99
0x6000'8000 | firmware |
@@ -20,7 +20,7 @@
2020
## HyperFlash
2121
```
2222
+--------------+
23-
0x6000'0000 | bootloader |
23+
0x6000'0000 | mboot |
2424
| |
2525
+--------------+
2626
0x6004'0000 | firmware |

ports/mimxrt/bootloader/boards/common.ld renamed to ports/mimxrt/mboot/boards/common.ld

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ text_start = interrupts_start + interrupts_size;
5757
text_size = (firmware_start - text_start);
5858

5959
firmware_size = flash_end - firmware_start;
60-
bootloader_flash_start = flash_start;
61-
bootloader_flash_size = firmware_start - bootloader_flash_start;
60+
mboot_flash_start = flash_start;
61+
mboot_flash_size = firmware_start - mboot_flash_start;
6262

6363
_estack = __StackTop;
6464
_sstack = __StackLimit;
@@ -254,7 +254,7 @@ SECTIONS
254254

255255
__DATA_END = __NDATA_ROM + (__noncachedata_end__ - __noncachedata_start__);
256256
text_end = ORIGIN(m_text) + LENGTH(m_text);
257-
ASSERT(__DATA_END <= (bootloader_flash_start + bootloader_flash_size), "region m_text overflowed with text and data")
257+
ASSERT(__DATA_END <= (mboot_flash_start + mboot_flash_size), "region m_text overflowed with text and data")
258258

259259
/* Uninitialized data section */
260260
.bss (NOLOAD):

ports/mimxrt/bootloader/boards/flexspi_nor_boot.c renamed to ports/mimxrt/mboot/boards/flexspi_nor_mboot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* SPDX-License-Identifier: BSD-3-Clause
66
*/
77

8-
#include "flexspi_nor_boot.h"
8+
#include "flexspi_nor_mboot.h"
99

1010
/* Component ID definition, used by tools. */
1111
#ifndef FSL_COMPONENT_ID

ports/mimxrt/bootloader/boards/flexspi_nor_boot.h renamed to ports/mimxrt/mboot/boards/flexspi_nor_mboot.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* SPDX-License-Identifier: BSD-3-Clause
66
*/
77

8-
#ifndef __FLEXSPI_NOR_BOOT_H__
9-
#define __FLEXSPI_NOR_BOOT_H__
8+
#ifndef __FLEXSPI_NOR_MBOOT_H__
9+
#define __FLEXSPI_NOR_MBOOT_H__
1010

1111
#include <stdint.h>
1212
#include "board.h"
@@ -100,12 +100,12 @@ typedef struct _boot_data_ {
100100
uint32_t placeholder; /* placehoder to make even 0x10 size */
101101
}BOOT_DATA_T;
102102

103-
extern uint32_t bootloader_flash_size;
104-
#define FLASH_SIZE (uint32_t)&bootloader_flash_size
103+
extern uint32_t mboot_flash_size;
104+
#define FLASH_SIZE (uint32_t)&mboot_flash_size
105105
#define PLUGIN_FLAG (uint32_t)0
106106

107107
/* External Variables */
108108
const BOOT_DATA_T boot_data;
109109
extern const uint8_t dcd_data[];
110110

111-
#endif /* __FLEXSPI_NOR_BOOT_H__ */
111+
#endif /* __FLEXSPI_NOR_MBOOT_H__ */

ports/mimxrt/bootloader/main.c renamed to ports/mimxrt/mboot/main.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838

3939
#include CPU_HEADER_H
4040
#include <stdlib.h>
41-
#include "boot_buffer.h"
42-
#include "boot_command.h"
43-
#include "boot_dfu.h"
44-
#include "boot_memory.h"
45-
#include "boot_validate.h"
41+
#include "mboot_buffer.h"
42+
#include "mboot_command.h"
43+
#include "mboot_dfu.h"
44+
#include "mboot_memory.h"
45+
#include "mboot_validate.h"
4646
#include "clock_config.h"
4747
#include "fw_header.h"
4848

@@ -54,7 +54,7 @@ typedef void (*firmware_entry_func)(void);
5454
// --------------------------------------------------------------------+
5555
// Local Variables
5656
// --------------------------------------------------------------------+
57-
MEM_AT_SECTION("._bl_command") boot_command_t bl_command;
57+
MEM_AT_SECTION("._bl_command") mboot_command_t bl_command;
5858
const uint8_t dcd_data[] = { 0x00 };
5959

6060
// --------------------------------------------------------------------+
@@ -83,8 +83,8 @@ int main(void) {
8383
board_init();
8484

8585
if (reprog_request() || !valid_fw_available()) {
86-
boot_dfu_init();
87-
boot_dfu_run();
86+
mboot_dfu_init();
87+
mboot_dfu_run();
8888
// Reset controller after upgrade
8989
NVIC_SystemReset();
9090
} else {
@@ -122,7 +122,7 @@ static bool reprog_request() {
122122
static bool valid_fw_available() {
123123
fw_header_t *fw_header = (fw_header_t *)MEM_GET_SYMBOL_VALUE(__firmware_start);
124124
uintptr_t start_addr = ((uintptr_t)MEM_GET_SYMBOL_VALUE(__firmware_start)) + sizeof(fw_header_t);
125-
boot_validate_status_t fw_status = boot_validate_firmware(fw_header, start_addr);
125+
mboot_validate_status_t fw_status = mboot_validate_firmware(fw_header, start_addr);
126126

127127
return fw_status == FWV_STATUS_OK ? true : false;
128128
}

ports/mimxrt/bootloader/boot_buffer.c renamed to ports/mimxrt/mboot/mboot_buffer.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
*/
2626

2727
#include <string.h>
28-
#include "boot_buffer.h"
29-
#include "boot_memory.h"
28+
#include "mboot_buffer.h"
29+
#include "mboot_memory.h"
3030

3131
// --------------------------------------------------------------------+
3232
// Local Variables
@@ -37,12 10000 +37,12 @@ static size_t buffer_length;
3737
// --------------------------------------------------------------------+
3838
// Global Function Definitions
3939
// --------------------------------------------------------------------+
40-
void boot_buffer_init(void) {
40+
void mboot_buffer_init(void) {
4141
buffer_length = 0UL;
4242
memset(&fw_buffer[0], 0, MICROPY_BOOT_BUFFER_SIZE);
4343
}
4444

45-
size_t boot_buffer_append(const uint8_t *data, size_t length) {
45+
size_t mboot_buffer_append(const uint8_t *data, size_t length) {
4646
size_t bytes_remaining = (size_t)MICROPY_BOOT_BUFFER_SIZE - buffer_length;
4747
size_t bytes_to_buffer = (bytes_remaining >= length) ? length : bytes_remaining;
4848

@@ -52,25 +52,25 @@ size_t boot_buffer_append(const uint8_t *data, size_t length) {
5252
return length - bytes_to_buffer;
5353
}
5454

55-
void boot_buffer_pad(void) {
55+
void mboot_buffer_pad(void) {
5656
if (buffer_length < MICROPY_BOOT_BUFFER_SIZE) {
5757
memset((void *)&fw_buffer[buffer_length], 0, (MICROPY_BOOT_BUFFER_SIZE - buffer_length));
5858
buffer_length = MICROPY_BOOT_BUFFER_SIZE;
5959
}
6060
}
6161

62-
void boot_buffer_reset(void) {
62+
void mboot_buffer_reset(void) {
6363
buffer_length = 0UL;
6464
}
6565

66-
uint8_t *boot_buffer_data_ptr(void) {
66+
uint8_t *mboot_buffer_data_ptr(void) {
6767
return &fw_buffer[0];
6868
}
6969

70-
bool boot_buffer_is_full(void) {
70+
bool mboot_buffer_is_full(void) {
7171
return (size_t)buffer_length >= MICROPY_BOOT_BUFFER_SIZE;
7272
}
7373

74-
size_t boot_buffer_len(void) {
74+
size_t mboot_buffer_len(void) {
7575
return (size_t)buffer_length;
7676
}

0 commit comments

Comments
 (0)
0