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:
@@ -1,28 +1,48 @@
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/shell/shell.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)
|
||||
{
|
||||
ARG_UNUSED(argc);
|
||||
ARG_UNUSED(argv);
|
||||
|
||||
shell_print(shell, "Rebooting system...");
|
||||
k_msleep(100); // Give time for message to be sent
|
||||
sys_reboot(SYS_REBOOT_WARM);
|
||||
shell_print(shell, "Resetting system...");
|
||||
k_msleep(100); // Give time for the message to be sent
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
LOG_INF("Firmware Node starting up");
|
||||
LOG_INF("Shell with reset command available");
|
||||
|
||||
LOG_INF("MCUboot serial recovery command available");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user