Skip to content

Commit

Permalink
Update Reboot option flags (#1757)
Browse files Browse the repository at this point in the history
***NO_CI***
  • Loading branch information
josesimoes authored Nov 6, 2020
1 parent b90b4c7 commit fcf876d
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 122 deletions.
4 changes: 2 additions & 2 deletions src/CLR/Debugger/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,8 @@ bool CLR_DBG_Debugger::Monitor_Reboot(WP_Message *msg)

if (NULL != cmd)
{
if (CLR_DBG_Commands::Monitor_Reboot::c_EnterBootloader ==
(cmd->m_flags & CLR_DBG_Commands::Monitor_Reboot::c_EnterBootloader))
if (CLR_DBG_Commands::Monitor_Reboot::c_EnterNanoBooter ==
(cmd->m_flags & CLR_DBG_Commands::Monitor_Reboot::c_EnterNanoBooter))
{
WP_ReplyToCommand(msg, true, false, NULL, 0);

Expand Down
55 changes: 30 additions & 25 deletions src/CLR/Include/WireProtocol_MonitorCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,45 @@
#include "WireProtocol_Message.h"
#include <nanoPackStruct.h>

// clang-format off

//////////////////////////////////////////
// enums

// structure for Monitor Reboot options
// backwards compatible with .NETMF
typedef enum Monitor_Reboot_Options
{
Monitor_Reboot_c_NormalReboot = 0,
Monitor_Reboot_c_EnterBootloader = 1,
Monitor_Reboot_c_ClrRebootOnly = 2,
Monitor_Reboot_c_ClrStopDebugger = 4
Monitor_Reboot_c_NormalReboot = 0,
Monitor_Reboot_c_EnterNanoBooter = 1,
Monitor_Reboot_c_ClrRebootOnly = 2,
Monitor_Reboot_c_ClrStopDebugger = 4,
Monitor_Reboot_c_EnterProprietaryBooter = 5
} Monitor_Reboot_Options;

// structure for Access Memory operations
typedef enum AccessMemory_Operations
{
// check if memory space is erased
AccessMemory_Check = 0x00,
AccessMemory_Check = 0x00,

// read block of data starting at a given address
AccessMemory_Read = 0x01,
AccessMemory_Read = 0x01,

// write block of data starting at a given address
AccessMemory_Write = 0x02,
AccessMemory_Write = 0x02,

// erase sector/block/page at a given address
AccessMemory_Erase = 0x03,
AccessMemory_Erase = 0x03,

AccessMemory_Mask = 0x0F
AccessMemory_Mask = 0x0F

} AccessMemory_Operations;

typedef enum MemoryMap_Options
{
Monitor_MemoryMap_c_RAM = 0x00000001,
Monitor_MemoryMap_c_FLASH = 0x00000002,
Monitor_MemoryMap_c_RAM = 0x00000001,
Monitor_MemoryMap_c_FLASH = 0x00000002,

} MemoryMap_Options;

Expand Down Expand Up @@ -80,17 +83,17 @@ typedef struct Monitor_OemInfo_Reply

typedef struct CLR_DBG_Commands_Monitor_ReadMemory
{
uint32_t address;
uint32_t length;
unsigned char data[1];
uint32_t address;
uint32_t length;
unsigned char data[1];

} CLR_DBG_Commands_Monitor_ReadMemory;

typedef struct CLR_DBG_Commands_Monitor_WriteMemory
{
uint32_t address;
uint32_t length;
unsigned char data[1];
uint32_t address;
uint32_t length;
unsigned char data[1];

} CLR_DBG_Commands_Monitor_WriteMemory;

Expand Down Expand Up @@ -136,19 +139,19 @@ typedef struct CLR_DBG_Commands_Monitor_MemoryMap

typedef struct Monitor_QueryConfiguration_Command
{
uint32_t Configuration;
uint32_t BlockIndex;
uint32_t Configuration;
uint32_t BlockIndex;

} Monitor_QueryConfiguration_Command;

typedef struct __nfpack Monitor_UpdateConfiguration_Command
{
uint32_t Configuration;
uint32_t BlockIndex;
uint32_t Length;
uint32_t Offset;
uint32_t Done;
uint8_t Data[1];
uint32_t Configuration;
uint32_t BlockIndex;
uint32_t Length;
uint32_t Offset;
uint32_t Done;
uint8_t Data[1];

} Monitor_UpdateConfiguration_Command;

Expand All @@ -158,6 +161,8 @@ typedef struct Monitor_UpdateConfiguration_Reply

} Monitor_UpdateConfiguration_Reply;

// clang-format on

//////////////////////////////////////////
// function declarations (commands)

Expand Down
9 changes: 5 additions & 4 deletions src/CLR/Include/nanoCLR_Debugging.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ struct CLR_DBG_Commands
/////////////////////////////////////////////////////////////////////////////////////////////////////////
struct Monitor_Reboot
{
static const unsigned int c_NormalReboot = 0;
static const unsigned int c_EnterBootloader = 1;
static const unsigned int c_ClrOnly = 2;
static const unsigned int c_WaitForDebugger = 4;
static const unsigned int c_NormalReboot = 0;
static const unsigned int c_EnterNanoBooter = 1;
static const unsigned int c_ClrOnly = 2;
static const unsigned int c_WaitForDebugger = 4;
static const unsigned int c_EnterProprietaryBooter = 5;

unsigned int m_flags;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ int Monitor_Reboot(WP_Message *message)
if (cmd != NULL)
{
// only reset if we are not trying to get into the bootloader
if ((cmd->m_flags & Monitor_Reboot_c_EnterBootloader) != Monitor_Reboot_c_EnterBootloader)
if ((cmd->m_flags & Monitor_Reboot_c_EnterNanoBooter) != Monitor_Reboot_c_EnterNanoBooter)
{
// RESET CPU
// because ChibiOS relies on CMSIS it's recommended to make use of the CMSIS API
Expand Down
Loading

0 comments on commit fcf876d

Please sign in to comment.