Skip to content

Commit

Permalink
Work on Debugger (#255)
Browse files Browse the repository at this point in the history
* Work on Debugger

- plug Debugger with WireProtocol in plain C
- fix #226
- completly replaced WireProtocol C++ with C version
- replace private_malloc with platform_malloc
- rework Monitor_FlashSectorMap to report full details on BlockStorage
- fixes #228
- further improvements in BlockStorage
- add stubs for COM
- add interface from BlockStorage interface to STM32 Flash driver
- rework nanoCLR VS Solution to make it compatible with latest changes
- revert several types to well know types
- add weak declarations to COM stubs in Win32
- correct linker scripts to have addresses aligned with sector boundaries
- add block storage definitions for all reference boards
- delete CMake file for NF_WireProtocol (is already in NF_Debugger)

Signed-off-by: José Simões <jose.simoes@eclo.solutions>
  • Loading branch information
josesimoes authored Mar 28, 2017
1 parent b921ff1 commit 9421271
Show file tree
Hide file tree
Showing 72 changed files with 1,406 additions and 1,249 deletions.
6 changes: 6 additions & 0 deletions CMake/Modules/FindNF_CoreCLR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ set(NF_CoreCLR_SRCS
# PAL
nanoPAL_BlockStorage.c

# PAL stubs
COM_stubs.c

)

foreach(SRC_FILE ${NF_CoreCLR_SRCS})
Expand Down Expand Up @@ -132,6 +135,9 @@ foreach(SRC_FILE ${NF_CoreCLR_SRCS})
${PROJECT_SOURCE_DIR}/src/PAL
${PROJECT_SOURCE_DIR}/src/PAL/BlockStorage

# PAL stubs
${PROJECT_SOURCE_DIR}/src/PAL/COM

CMAKE_FIND_ROOT_PATH_BOTH
)
# message("${SRC_FILE} >> ${NF_CoreCLR_SRC_FILE}") # debug helper
Expand Down
1 change: 0 additions & 1 deletion CMake/Modules/FindNF_Debugger.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ set(NF_Debugger_SRCS
Debugger_full.cpp

Messaging.cpp
WireProtocol.cpp

WireProtocol_Message.c
WireProtocol_MonitorCommands.c
Expand Down
37 changes: 0 additions & 37 deletions CMake/Modules/FindNF_WireProtocol.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion src/CLR/Core/CLR_RT_Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static int s_PreHeapInitIndex = 0;

////////////////////////////////////////////////////////////

HAL_DECLARE_CUSTOM_HEAP( CLR_RT_Memory::Allocate, CLR_RT_Memory::Release, CLR_RT_Memory::ReAllocate );


//--//

Expand Down
4 changes: 2 additions & 2 deletions src/CLR/Core/Execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ HRESULT CLR_RT_ExecutionEngine::Execute( wchar_t* entryPointArgs, int maxContext
#endif

//By skipping the whole CLRStartup routine, the Monitor_Program_Exit message never gets sent to clients.
CLR_EE_DBG_EVENT_BROADCAST(CLR_DBG_Commands::c_Monitor_ProgramExit,0,NULL,WP_Flags::c_NonCritical);
CLR_EE_DBG_EVENT_BROADCAST(CLR_DBG_Commands::c_Monitor_ProgramExit,0,NULL,WP_Flags_c_NonCritical);
WaitForDebugger();
#endif

Expand Down Expand Up @@ -3013,7 +3013,7 @@ void CLR_RT_ExecutionEngine::StopOnBreakpoint( CLR_DBG_Commands::Debugging_Execu

if(m_breakpointsActiveNum == 1)
{
CLR_EE_DBG_EVENT_SEND(CLR_DBG_Commands::c_Debugging_Execution_BreakpointHit, sizeof(CLR_DBG_Commands::Debugging_Execution_BreakpointDef), &m_breakpointsActive[0], WP_Flags::c_NonCritical);
CLR_EE_DBG_EVENT_SEND(CLR_DBG_Commands::c_Debugging_Execution_BreakpointHit, sizeof(CLR_DBG_Commands::Debugging_Execution_BreakpointDef), &m_breakpointsActive[0],WP_Flags_c_NonCritical);
}
}
else
Expand Down
21 changes: 11 additions & 10 deletions src/CLR/Core/Hardware/Hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ HRESULT CLR_HW_Hardware::Hardware_Initialize()
m_MessagingEventsMask = 0;

#if defined(NANOCLR_ENABLE_SOURCELEVELDEBUGGING)
m_DebuggerEventsMask |= ExtractEventFromTransport( HalSystemConfig.DebuggerPorts[ 0 ] );
m_DebuggerEventsMask |= ExtractEventFromTransport( HalSystemConfig.DebuggerPort );
#endif

m_MessagingEventsMask |= ExtractEventFromTransport( HalSystemConfig.MessagingPorts[ 0 ] );
m_MessagingEventsMask |= ExtractEventFromTransport( HalSystemConfig.MessagingPort );

m_wakeupEvents = c_Default_WakeupEvents | m_DebuggerEventsMask;
m_powerLevel = PowerLevel__Active;
Expand Down Expand Up @@ -89,25 +89,26 @@ void CLR_HW_Hardware::ProcessActivity()
if(!HAL_CONTINUATION::Dequeue_And_Execute()) break;
}

if(!msg.IsDebuggerInitialized())
{
msg.InitializeDebugger();
}
msg.PurgeCache();
// UNDONE: FIXME:
//if(!msg.IsDebuggerInitialized())
//{
// msg.InitializeDebugger();
//}
// UNDONE: FIXME:msg.PurgeCache();

dbg.PurgeCache();
// UNDONE: FIXME:dbg.PurgeCache();

unsigned int events = ::Events_Get( m_wakeupEvents );
unsigned int eventsCLR = 0;

if(events & m_MessagingEventsMask)
{
msg.ProcessCommands();
//msg.ProcessCommands();
}

if(events & m_DebuggerEventsMask)
{
dbg.ProcessCommands();
//dbg.ProcessCommands();

#if defined(PLATFORM_ARM)
if(CLR_EE_DBG_IS(RebootPending))
Expand Down
2 changes: 1 addition & 1 deletion src/CLR/Core/HeapPersistence/Heap_Persistence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ bool CLR_RT_Persistence_Manager::Bank::Erase( int& blockIndex )

pRange = &pRegion->BlockRanges[ m_stream.RangeIndex ];

if(BlockRange_GetBlockCount(pRange) <= (CLR_UINT32)blockIndex)
if(BlockRange_GetBlockCount(pRegion->BlockRanges[m_stream.RangeIndex]) <= (CLR_UINT32)blockIndex)
{
return false;
}
Expand Down
Loading

0 comments on commit 9421271

Please sign in to comment.