Fix MCUboot and app flash partitioning
- Corrected device tree overlays to prevent MCUboot and app overlap - MCUboot now at 0x8000000 (32KB), app at 0x8008000 (96KB) - Successfully boots MCUboot which chains to application - Shell and reset command working properly - Black Magic Probe flashing confirmed working for both domains
This commit is contained in:
parent
928a176e7c
commit
cc6b4488ee
|
|
@ -1,28 +1,48 @@
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
|
#include <zephyr/logging/log.h>
|
||||||
#include <zephyr/shell/shell.h>
|
#include <zephyr/shell/shell.h>
|
||||||
#include <zephyr/sys/reboot.h>
|
#include <zephyr/sys/reboot.h>
|
||||||
#include <zephyr/logging/log.h>
|
|
||||||
|
|
||||||
LOG_MODULE_REGISTER(firmware_node, LOG_LEVEL_DBG);
|
LOG_MODULE_REGISTER(firmware_node, LOG_LEVEL_INF);
|
||||||
|
|
||||||
|
// Custom reset command handler
|
||||||
static int cmd_reset(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_reset(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
shell_print(shell, "Rebooting system...");
|
shell_print(shell, "Resetting system...");
|
||||||
k_msleep(100); // Give time for message to be sent
|
k_msleep(100); // Give time for the message to be sent
|
||||||
sys_reboot(SYS_REBOOT_WARM);
|
sys_reboot(SYS_REBOOT_COLD);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// MCUboot serial recovery command handler
|
||||||
|
static int cmd_mcuboot_recovery(const struct shell *shell, size_t argc, char **argv)
|
||||||
|
{
|
||||||
|
ARG_UNUSED(argc);
|
||||||
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
|
shell_print(shell, "Entering MCUboot serial recovery mode...");
|
||||||
|
shell_print(shell, "System will reset and MCUboot will wait for image upload via mcumgr");
|
||||||
|
k_msleep(100); // Give time for the message to be sent
|
||||||
|
|
||||||
|
// TODO: Set a flag or trigger MCUboot serial recovery mode
|
||||||
|
// For now, just reset - MCUboot serial recovery needs to be enabled
|
||||||
|
sys_reboot(SYS_REBOOT_COLD);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_CMD_REGISTER(reset, NULL, "Reset the system", cmd_reset);
|
SHELL_CMD_REGISTER(reset, NULL, "Reset the system", cmd_reset);
|
||||||
|
SHELL_CMD_REGISTER(mcuboot_recovery, NULL, "Enter MCUboot serial recovery mode", cmd_mcuboot_recovery);
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
LOG_INF("Firmware Node starting up");
|
LOG_INF("Firmware Node starting up");
|
||||||
LOG_INF("Shell with reset command available");
|
LOG_INF("Shell with reset command available");
|
||||||
|
LOG_INF("MCUboot serial recovery command available");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,14 @@
|
||||||
CONFIG_LOG=y
|
CONFIG_LOG=y
|
||||||
CONFIG_BOOT_BANNER=y
|
CONFIG_BOOT_BANNER=y
|
||||||
CONFIG_MCUBOOT_LOG_LEVEL_DBG=y
|
CONFIG_MCUBOOT_LOG_LEVEL_DBG=y
|
||||||
# Enable console in MCUboot to see debug output
|
# Disable console in MCUboot to allow serial recovery
|
||||||
CONFIG_CONSOLE=y
|
CONFIG_CONSOLE=n
|
||||||
# Single slot configuration (no upgrades)
|
# Single slot configuration (no upgrades)
|
||||||
CONFIG_SINGLE_APPLICATION_SLOT=y
|
CONFIG_SINGLE_APPLICATION_SLOT=y
|
||||||
|
|
||||||
|
# Enable MCUboot serial recovery for firmware updates
|
||||||
|
CONFIG_MCUBOOT_SERIAL=y
|
||||||
|
CONFIG_BOOT_SERIAL_CDC_ACM=y
|
||||||
|
|
||||||
# Disable signature validation for testing
|
# Disable signature validation for testing
|
||||||
CONFIG_BOOT_SIGNATURE_TYPE_NONE=y
|
CONFIG_BOOT_SIGNATURE_TYPE_NONE=y
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue