File tree Expand file tree Collapse file tree 4 files changed +42
-1
lines changed
Expand file tree Collapse file tree 4 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ smart-leds = "0.3"
4444esp-println = { version = " 0.2.0" , features = [" esp32c3" ] }
4545
4646[features ]
47- default = [" idfboot " , " rt" ]
47+ default = [" mcuboot " , " rt" ]
4848idfboot = []
4949mcuboot = []
5050direct-boot = []
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ extern "C" {
5151 num: u32 ,
5252 fixed: u32 ,
5353 ) -> i32 ;
54+ fn esp_rom_printf( format: * const u8 , ...) -> i32 ;
5455
5556 /* IROM metadata:
5657 * - Destination address (VMA) for IROM region
@@ -395,6 +396,9 @@ pub fn mp_hook() -> bool {
395396 #[ cfg( feature = "mcuboot" ) ]
396397 unsafe {
397398 configure_mmu ( ) ;
399+
400+ static MESSAGE : & [ u8 ] = b"Welcome to Rust from MCUboot!\n \0 " ;
401+ esp_rom_printf ( MESSAGE . as_ptr ( ) ) ;
398402 }
399403
400404 unsafe {
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ #
3+ # Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd.
4+ #
5+ # SPDX-License-Identifier: Apache-2.0
6+ #
7+
8+ SCRIPT_NAME=$( basename " ${BASH_SOURCE[0]} " )
9+
10+ set -eo pipefail
11+
12+ usage () {
13+ echo " "
14+ echo " USAGE: ${SCRIPT_NAME} <ELF>"
15+ echo " "
16+ }
17+
18+ if [ -z " ${1} " ]; then
19+ echo " ERROR: Missing application ELF file."
20+ usage
21+ exit 1
22+ fi
23+
24+ # MCUboot's tool for image signing and key management
25+ if ! command -v imgtool & > /dev/null; then
26+ echo " "
27+ echo " imgtool not found. Please run: \" pip install imgtool\" "
28+ echo " "
29+ exit 1
30+ fi
31+
32+ elf_file=${1}
33+
34+ objcopy -O ihex " ${elf_file} " app.hex
35+ imgtool sign --pad --align 4 -v 0 -s auto -H 32 --pad-header -S 0x100000 app.hex app.bin
36+ esptool.py -c esp32c3 -p /dev/ttyUSB0 -b 921600 --after no_reset write_flash -fs 4MB -fm dio -ff 40m 0x0 ./mcuboot-esp32c3.bin 0x110000 ./app.bin
37+ picocom -b 115200 /dev/ttyUSB0 --imap lfcrlf
You can’t perform that action at this time.
0 commit comments