diff --git a/Application/EraseDeployment/EraseDeployment.cpp b/Application/EraseDeployment/EraseDeployment.cpp
index cff7d5afd..bd87c5ec4 100644
--- a/Application/EraseDeployment/EraseDeployment.cpp
+++ b/Application/EraseDeployment/EraseDeployment.cpp
@@ -9,8 +9,6 @@
#include "tinyhal.h"
-HAL_DECLARE_NULL_HEAP();
-
void ApplicationEntryPoint()
{
int nSects = 0;
diff --git a/Application/MicroBooter/MicroBooter.cpp b/Application/MicroBooter/MicroBooter.cpp
index 4185b6247..01974507a 100644
--- a/Application/MicroBooter/MicroBooter.cpp
+++ b/Application/MicroBooter/MicroBooter.cpp
@@ -22,8 +22,6 @@ BOOL MemStreamSeekBlockAddress( BlockStorageStream &stream, UINT32 address );
static SREC_Handler g_SREC;
#endif
-HAL_DECLARE_CUSTOM_HEAP( SimpleHeap_Allocate, SimpleHeap_Release, SimpleHeap_ReAllocate );
-
#pragma arm section zidata = "s_SystemStates"
static INT32 s_SystemStates[SYSTEM_STATE_TOTAL_STATES];
#pragma arm section zidata
@@ -265,7 +263,7 @@ static BOOL Memory_Read( UINT32 address, UINT32 length, BYTE* data )
if(s_ReadBuffer == NULL)
{
- s_ReadBuffer = (UINT8*)private_malloc(readBufferSize);
+ s_ReadBuffer = (UINT8*)malloc(readBufferSize);
ASSERT(s_ReadBuffer != NULL);
if(s_ReadBuffer == NULL) return FALSE;
@@ -433,14 +431,6 @@ void BootEntryLoader()
Events_Initialize();
- UINT8* BaseAddress;
- UINT32 SizeInBytes;
-
- HeapLocation( BaseAddress, SizeInBytes );
-
- // Initialize custom heap with heap block returned from CustomHeapLocation
- SimpleHeap_Initialize( BaseAddress, SizeInBytes );
-
// this is the place where interrupts are enabled after boot for the first time after boot
ENABLE_INTERRUPTS();
diff --git a/Application/MicroBooter/SrecProcessor.cpp b/Application/MicroBooter/SrecProcessor.cpp
index feb4b904b..9377e2443 100644
--- a/Application/MicroBooter/SrecProcessor.cpp
+++ b/Application/MicroBooter/SrecProcessor.cpp
@@ -55,7 +55,7 @@ BOOL SREC_Handler::Process( char c )
if(!m_Stream.IsXIP())
{
- dstExec = (UINT32)private_malloc(m_ImageLength);
+ dstExec = (UINT32)malloc(m_ImageLength);
MemStreamSeekBlockAddress( m_Stream, m_ImageStart );
diff --git a/Application/TinyBooter/Commands.cpp b/Application/TinyBooter/Commands.cpp
index e130c73c2..ce2886f17 100644
--- a/Application/TinyBooter/Commands.cpp
+++ b/Application/TinyBooter/Commands.cpp
@@ -80,7 +80,7 @@ struct BitFieldManager
{
const BlockDeviceInfo* deviceInfo = m_blockDevice->GetDeviceInfo();
- data = (BYTE*)private_malloc( m_region->BytesPerBlock );
+ data = (BYTE*)malloc( m_region->BytesPerBlock );
if(data != NULL)
{
@@ -99,7 +99,7 @@ struct BitFieldManager
ConfigurationSector *pCfg = (ConfigurationSector*)data;
memset( (void*)&pCfg->SignatureCheck[ 0 ], 0xFF, sizeof(pCfg->SignatureCheck) );
m_blockDevice->Write( m_cfgPhysicalAddress, m_region->BytesPerBlock,data, FALSE );
- private_free(data);
+ free(data);
}
else
{
@@ -150,7 +150,7 @@ struct BitFieldManager
else
{
UINT32 length = m_region->BytesPerBlock;
- BYTE* dataptr = (BYTE*)private_malloc(length);
+ BYTE* dataptr = (BYTE*)malloc(length);
if(dataptr != NULL)
{
@@ -174,7 +174,7 @@ struct BitFieldManager
// write back to sector, as we only change one bit from 0 to 1, no need to erase sector
m_blockDevice->Write( m_cfgPhysicalAddress, length, dataptr, FALSE );
- private_free(dataptr);
+ free(dataptr);
}
}
@@ -227,7 +227,7 @@ struct BitFieldManager
UINT32 length = sizeof(ConfigurationSector);
memset( &m_skipCfgSectorCheck, 0xff, sizeof(m_skipCfgSectorCheck) );
- data = (BYTE*)private_malloc(length);
+ data = (BYTE*)malloc(length);
stream.Device->Read( m_cfgPhysicalAddress, length, (BYTE *)data );
configSector = (ConfigurationSector*)data;
m_signatureCheck = NULL;
@@ -253,7 +253,7 @@ struct BitFieldManager
m_signatureCheck = &m_skipCfgSectorCheck;
}
- private_free(data);
+ free(data);
}
else // XIP device
@@ -476,7 +476,7 @@ static bool AccessMemory( UINT32 location, UINT32 lengthInBytes, BYTE* buf, int
{
if (mode == AccessMemory_Check)
{
- bufPtr = (BYTE*) private_malloc(NumOfBytes);
+ bufPtr = (BYTE*) malloc(NumOfBytes);
if(!bufPtr) return false;
}
@@ -486,7 +486,7 @@ static bool AccessMemory( UINT32 location, UINT32 lengthInBytes, BYTE* buf, int
{
if (mode == AccessMemory_Check)
{
- private_free(bufPtr);
+ free(bufPtr);
}
break;
@@ -495,7 +495,7 @@ static bool AccessMemory( UINT32 location, UINT32 lengthInBytes, BYTE* buf, int
if (mode == AccessMemory_Check)
{
*(UINT32*)buf = SUPPORT_ComputeCRC( bufPtr, NumOfBytes, *(UINT32*)buf );
- private_free(bufPtr);
+ free(bufPtr);
}
}
break;
@@ -525,18 +525,18 @@ static bool AccessMemory( UINT32 location, UINT32 lengthInBytes, BYTE* buf, int
{
if(g_ConfigBuffer != NULL)
{
- private_free(g_ConfigBuffer);
+ free(g_ConfigBuffer);
}
g_ConfigBufferLength = 0;
- // g_ConfigBuffer = (UINT8*)private_malloc(pRegion->BytesPerBlock);
+ // g_ConfigBuffer = (UINT8*)malloc(pRegion->BytesPerBlock);
// Just allocate the configuration Sector size, configuration block can be large and not necessary to have that buffer.
- g_ConfigBuffer = (UINT8*)private_malloc(g_ConfigBufferTotalSize);
+ g_ConfigBuffer = (UINT8*)malloc(g_ConfigBufferTotalSize);
}
else if(g_ConfigBufferTotalSize < ( g_ConfigBufferLength + lengthInBytes))
{
- UINT8* tmp = (UINT8*)private_malloc(g_ConfigBufferLength + lengthInBytes);
+ UINT8* tmp = (UINT8*)malloc(g_ConfigBufferLength + lengthInBytes);
if(tmp == NULL)
{
@@ -545,7 +545,7 @@ static bool AccessMemory( UINT32 location, UINT32 lengthInBytes, BYTE* buf, int
memcpy( tmp, g_ConfigBuffer, g_ConfigBufferLength );
- private_free(g_ConfigBuffer);
+ free(g_ConfigBuffer);
g_ConfigBuffer = tmp;
}
@@ -754,7 +754,7 @@ bool Loader_Engine::SignedDataState::VerifySignature( UINT8* signature, UINT32 l
const BlockDeviceInfo* deviceInfo = m_pDevice->GetDeviceInfo();
if(!deviceInfo->Attribute.SupportsXIP)
{
- signCheckedAddr = (BYTE*)private_malloc(m_dataLength);
+ signCheckedAddr = (BYTE*)malloc(m_dataLength);
if (signCheckedAddr == NULL)
{
EraseMemoryAndReset();
@@ -764,7 +764,7 @@ bool Loader_Engine::SignedDataState::VerifySignature( UINT8* signature, UINT32 l
if(!m_pDevice->Read( m_dataAddress, m_dataLength, signCheckedAddr ))
{
EraseMemoryAndReset();
- private_free(signCheckedAddr);
+ free(signCheckedAddr);
return false;
}
@@ -791,7 +791,7 @@ bool Loader_Engine::SignedDataState::VerifySignature( UINT8* signature, UINT32 l
if(!deviceInfo->Attribute.SupportsXIP)
{
- private_free(signCheckedAddr);
+ free(signCheckedAddr);
}
return fret;
@@ -1542,7 +1542,7 @@ bool Loader_Engine::Monitor_FlashSectorMap( WP_Message* msg )
if(cnt == 1)
{
- pData = (struct Flash_Sector*)private_malloc(rangeCount * sizeof(struct Flash_Sector));
+ pData = (struct Flash_Sector*)malloc(rangeCount * sizeof(struct Flash_Sector));
if(pData == NULL)
{
@@ -1582,7 +1582,7 @@ bool Loader_Engine::Monitor_FlashSectorMap( WP_Message* msg )
ReplyToCommand(msg, true, false, (void*)pData, rangeCount * sizeof (struct Flash_Sector) );
- private_free(pData);
+ free(pData);
return true;
}
diff --git a/Application/TinyBooter/ConfigurationManager.cpp b/Application/TinyBooter/ConfigurationManager.cpp
index c3a43da18..acd012582 100644
--- a/Application/TinyBooter/ConfigurationManager.cpp
+++ b/Application/TinyBooter/ConfigurationManager.cpp
@@ -130,7 +130,7 @@ void ConfigurationSectorManager::WriteConfiguration( UINT32 writeOffset, BYTE *d
// Copy the whole block to a buffer, for NonXIP or need to erase block
if ((eraseWrite) || (!m_fSupportsXIP))
{
- configurationInBytes =(BYTE*)private_malloc(writeLengthInBytes);
+ configurationInBytes =(BYTE*)malloc(writeLengthInBytes);
// load data to the local buffer.
if (configurationInBytes)
@@ -154,7 +154,7 @@ void ConfigurationSectorManager::WriteConfiguration( UINT32 writeOffset, BYTE *d
// rewrite from the start of block
m_device->Write( m_cfgPhysicalAddress, writeLengthInBytes, configurationInBytes, FALSE );
- private_free(configurationInBytes);
+ free(configurationInBytes);
}
diff --git a/Application/TinyBooter/CryptoInterface.cpp b/Application/TinyBooter/CryptoInterface.cpp
index caf1afe3c..40ac50f36 100644
--- a/Application/TinyBooter/CryptoInterface.cpp
+++ b/Application/TinyBooter/CryptoInterface.cpp
@@ -111,7 +111,7 @@ bool CryptoState::VerifySignature( UINT32 keyIndex )
}
// free RAM buffer
- private_free(g_ConfigBuffer);
+ free(g_ConfigBuffer);
g_ConfigBuffer = NULL;
return fRet;
diff --git a/Application/TinyBooter/TinyBooter.cpp b/Application/TinyBooter/TinyBooter.cpp
index 9b98750bc..0c702af97 100644
--- a/Application/TinyBooter/TinyBooter.cpp
+++ b/Application/TinyBooter/TinyBooter.cpp
@@ -18,22 +18,11 @@ Loader_Engine g_eng;
//--//
-HAL_DECLARE_CUSTOM_HEAP( SimpleHeap_Allocate, SimpleHeap_Release, SimpleHeap_ReAllocate );
-
-//--//
-
void ApplicationEntryPoint()
{
INT32 timeout = 20000; // 20 second timeout
bool enterBootMode = false;
- // crypto API needs to allocate memory. Initialize simple heap for it.
- UINT8* BaseAddress;
- UINT32 SizeInBytes;
-
- HeapLocation ( BaseAddress, SizeInBytes );
- SimpleHeap_Initialize( BaseAddress, SizeInBytes );
-
g_eng.Initialize( HalSystemConfig.DebuggerPorts[ 0 ] );
// internal reset and stop check
diff --git a/Application/TinyBooter/TinyBooterDecompressor.cpp b/Application/TinyBooter/TinyBooterDecompressor.cpp
index 45449f93e..60f988795 100644
--- a/Application/TinyBooter/TinyBooterDecompressor.cpp
+++ b/Application/TinyBooter/TinyBooterDecompressor.cpp
@@ -12,8 +12,6 @@ typedef unsigned char UINT8;
int LZ77_Decompress( UINT8* inBuf, int inSize, UINT8* outBuf, int outSize );
-HAL_DECLARE_NULL_HEAP();
-
typedef void (*APP_ENTRY_POINT)();
extern "C"
diff --git a/CLR/Core/CLR_RT_Memory.cpp b/CLR/Core/CLR_RT_Memory.cpp
index 0b9998bc0..456f7cad2 100644
--- a/CLR/Core/CLR_RT_Memory.cpp
+++ b/CLR/Core/CLR_RT_Memory.cpp
@@ -16,8 +16,6 @@ static int s_PreHeapInitIndex = 0;
////////////////////////////////////////////////////////////
-HAL_DECLARE_CUSTOM_HEAP( CLR_RT_Memory::Allocate, CLR_RT_Memory::Release, CLR_RT_Memory::ReAllocate );
-
//--//
void CLR_RT_Memory::Reset()
diff --git a/CLR/Debugger/Debugger.cpp b/CLR/Debugger/Debugger.cpp
index 5b5c48684..24eb93b16 100644
--- a/CLR/Debugger/Debugger.cpp
+++ b/CLR/Debugger/Debugger.cpp
@@ -427,7 +427,7 @@ bool CLR_DBG_Debugger::Monitor_FlashSectorMap( WP_Message* msg, void* owner )
if(cnt == 1)
{
- pData = (struct Flash_Sector*)private_malloc(rangeCount * sizeof(struct Flash_Sector));
+ pData = (struct Flash_Sector*)malloc(rangeCount * sizeof(struct Flash_Sector));
if(pData == NULL)
{
@@ -467,7 +467,7 @@ bool CLR_DBG_Debugger::Monitor_FlashSectorMap( WP_Message* msg, void* owner )
dbg->m_messaging->ReplyToCommand( msg, true, false, (void*)pData, rangeCount * sizeof (struct Flash_Sector) );
- private_free(pData);
+ free(pData);
}
return true;
@@ -1210,7 +1210,7 @@ bool CLR_DBG_Debugger::Debugging_MFUpdate_AuthCommand( WP_Message* msg, void* ow
{
int cmdSize = respLen + offsetof(CLR_DBG_Commands::Debugging_MFUpdate_AuthCommand::Reply, m_response);
- CLR_DBG_Commands::Debugging_MFUpdate_AuthCommand::Reply* pTmp = (CLR_DBG_Commands::Debugging_MFUpdate_AuthCommand::Reply*)private_malloc(cmdSize);
+ CLR_DBG_Commands::Debugging_MFUpdate_AuthCommand::Reply* pTmp = (CLR_DBG_Commands::Debugging_MFUpdate_AuthCommand::Reply*)malloc(cmdSize);
if(pTmp != NULL)
{
@@ -1223,7 +1223,7 @@ bool CLR_DBG_Debugger::Debugging_MFUpdate_AuthCommand( WP_Message* msg, void* ow
}
else
{
- private_free(pTmp);
+ free(pTmp);
}
}
}
@@ -1233,7 +1233,7 @@ bool CLR_DBG_Debugger::Debugging_MFUpdate_AuthCommand( WP_Message* msg, void* ow
if(pReply != &reply)
{
- private_free(pReply);
+ free(pReply);
}
return true;
@@ -1297,7 +1297,7 @@ bool CLR_DBG_Debugger::Debugging_MFUpdate_GetMissingPkts( WP_Message* msg, void*
if(MFUpdate_GetMissingPackets(cmd->m_updateHandle, &s_missingPkts[0], &int32Cnt))
{
- pReply = (CLR_DBG_Commands::Debugging_MFUpdate_GetMissingPkts::Reply*)private_malloc(sizeBytes);
+ pReply = (CLR_DBG_Commands::Debugging_MFUpdate_GetMissingPkts::Reply*)malloc(sizeBytes);
if(pReply != NULL)
{
@@ -1318,7 +1318,7 @@ bool CLR_DBG_Debugger::Debugging_MFUpdate_GetMissingPkts( WP_Message* msg, void*
if(pReply != &reply)
{
- private_free(pReply);
+ free(pReply);
}
return true;
@@ -1953,7 +1953,7 @@ bool CLR_DBG_Debugger::Debugging_Thread_Get( WP_Message* msg, void* owner )
if(!fFound)
{
- pThread = (CLR_RT_HeapBlock*)private_malloc(sizeof(CLR_RT_HeapBlock));
+ pThread = (CLR_RT_HeapBlock*)malloc(sizeof(CLR_RT_HeapBlock));
//Create the managed thread.
//This implies that there is no state in the managed object. This is not exactly true, as the managed thread
diff --git a/CLR/Graphics/Graphics.cpp b/CLR/Graphics/Graphics.cpp
index 71e59349d..033ea1231 100644
--- a/CLR/Graphics/Graphics.cpp
+++ b/CLR/Graphics/Graphics.cpp
@@ -109,8 +109,8 @@ HRESULT CLR_GFX_Bitmap::CreateInstance( CLR_RT_HeapBlock& ref, const CLR_GFX_Bit
}
else
{
- //The bitmap is too big to fit on the managed heap, so put it on the SimpleHeap
- bitmap = (CLR_GFX_Bitmap*)SimpleHeap_Allocate(size);
+ //The bitmap is too big to fit on the managed heap, so put it on the heap
+ bitmap = (CLR_GFX_Bitmap*)malloc(size);
ref.SetInteger((CLR_UINT32)bitmap);
ref.PerformBoxingIfNeeded();
@@ -195,7 +195,7 @@ HRESULT CLR_GFX_Bitmap::CreateInstance( CLR_RT_HeapBlock& ref, const CLR_UINT8*
/* When loading a Windows BMP, GIF, or JPEG file, it is converted in-place to the native BPP.
* When loading a compressed TinyCLR Bitmap from a resource file, two bitmaps are needed to decompress, then convert.
* This fragments the heap and wastes space until the next garbage collection is done.
- * When using the SimpleHeap, there is no relocation, so decompressing into a temp bitmap into the simpleheap wastes
+ * When using the heap, there is no relocation, so decompressing into a temp bitmap into the heap wastes
* memory 6.25% the size of the 16bpp bitmap that's saved.
*/
@@ -310,7 +310,7 @@ HRESULT CLR_GFX_Bitmap::DeleteInstance( CLR_RT_HeapBlock& ref )
if (blob->IsBoxed() && blob[ 1 ].DataType() == DATATYPE_U4)
{
bitmap = (CLR_GFX_Bitmap*)(blob[ 1 ].NumericByRefConst().u4);
- SimpleHeap_Release (bitmap);
+ free(bitmap);
}
else
{
diff --git a/CLR/Libraries/SPOT_Hardware/spot_hardware_native_Microsoft_SPOT_Hardware_LargeBuffer.cpp b/CLR/Libraries/SPOT_Hardware/spot_hardware_native_Microsoft_SPOT_Hardware_LargeBuffer.cpp
index 7a5b4f522..b647ed4c9 100644
--- a/CLR/Libraries/SPOT_Hardware/spot_hardware_native_Microsoft_SPOT_Hardware_LargeBuffer.cpp
+++ b/CLR/Libraries/SPOT_Hardware/spot_hardware_native_Microsoft_SPOT_Hardware_LargeBuffer.cpp
@@ -17,7 +17,7 @@ HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_LargeBuffer::Create
reflex.m_levels = 1;
reflex.m_data.m_type = g_CLR_RT_WellKnownTypes.m_UInt8;
- CLR_RT_HeapBlock_Array* pData = (CLR_RT_HeapBlock_Array*)SimpleHeap_Allocate(size + sizeof(CLR_RT_HeapBlock_Array)); CHECK_ALLOCATION(pData);
+ CLR_RT_HeapBlock_Array* pData = (CLR_RT_HeapBlock_Array*)malloc(size + sizeof(CLR_RT_HeapBlock_Array)); CHECK_ALLOCATION(pData);
CLR_RT_Memory::ZeroFill(pData, size + sizeof(CLR_RT_HeapBlock_Array));
@@ -57,7 +57,7 @@ HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_LargeBuffer::Intern
CLR_RT_HeapBlock_Array* hbRef = hbBytes.DereferenceArray(); FAULT_ON_NULL(hbRef);
- SimpleHeap_Release(hbRef);
+ free(hbRef);
hbBytes.SetObjectReference( NULL );
@@ -112,7 +112,7 @@ HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_LargeBufferMarshall
if(array->m_numOfElements != size)
{
- SimpleHeap_Release(array);
+ free(array);
TINYCLR_CHECK_HRESULT(Library_spot_hardware_native_Microsoft_SPOT_Hardware_LargeBuffer::CreateBufferHelper( pLB[Library_spot_hardware_native_Microsoft_SPOT_Hardware_LargeBuffer::FIELD__m_bytes], size ));
diff --git a/CLR/Tools/BuildHelper/BuildHelper.cpp b/CLR/Tools/BuildHelper/BuildHelper.cpp
index 03a6be931..299642aff 100644
--- a/CLR/Tools/BuildHelper/BuildHelper.cpp
+++ b/CLR/Tools/BuildHelper/BuildHelper.cpp
@@ -875,8 +875,6 @@ int _tmain(int argc, _TCHAR* argv[])
TINYCLR_CHECK_HRESULT(HAL_Windows::Memory_Resize( 64 * 1024 * 1024 ));
- HAL_Init_Custom_Heap();
-
CLR_RT_Memory::Reset ();
st.PushArguments( argc-1, argv+1, vec );
diff --git a/CLR/Tools/MetaDataProcessor/MetaDataProcessor.cpp b/CLR/Tools/MetaDataProcessor/MetaDataProcessor.cpp
index 9a91480eb..6ef1aa7cf 100644
--- a/CLR/Tools/MetaDataProcessor/MetaDataProcessor.cpp
+++ b/CLR/Tools/MetaDataProcessor/MetaDataProcessor.cpp
@@ -1784,7 +1784,6 @@ int _tmain(int argc, _TCHAR* argv[])
::CoInitialize( 0 );
TINYCLR_CHECK_HRESULT(HAL_Windows::Memory_Resize( 64 * 1024 * 1024 ));
- HAL_Init_Custom_Heap();
// do not display assembly load information
s_CLR_RT_fTrace_AssemblyOverhead = 0;
diff --git a/CLR/Tools/TFConvert/TFConvert.cpp b/CLR/Tools/TFConvert/TFConvert.cpp
index 5f215c76d..691d83594 100644
--- a/CLR/Tools/TFConvert/TFConvert.cpp
+++ b/CLR/Tools/TFConvert/TFConvert.cpp
@@ -192,7 +192,6 @@ int _tmain(int argc, _TCHAR* argv[])
TINYCLR_CHECK_HRESULT(::CoInitialize( 0 ));
TINYCLR_CHECK_HRESULT(HAL_Windows::Memory_Resize( 16 * 1024 * 1024 ));
- HAL_Init_Custom_Heap();
CLR_RT_Memory::Reset ();
diff --git a/CLR/Tools/Tools.settings b/CLR/Tools/Tools.settings
index c6627a6f3..e3478fb81 100644
--- a/CLR/Tools/Tools.settings
+++ b/CLR/Tools/Tools.settings
@@ -31,11 +31,6 @@
-
-
-
-
-
diff --git a/DeviceCode/Cores/arm/Processors/CortexMx/TinyHal/GNU_S/AppEntry.s b/DeviceCode/Cores/arm/Processors/CortexMx/TinyHal/GNU_S/AppEntry.s
index 14b29179c..3e37666af 100644
--- a/DeviceCode/Cores/arm/Processors/CortexMx/TinyHal/GNU_S/AppEntry.s
+++ b/DeviceCode/Cores/arm/Processors/CortexMx/TinyHal/GNU_S/AppEntry.s
@@ -24,13 +24,9 @@
.global EntryPoint
- .global StackBottom
- .global StackTop
.global HeapBegin
.global HeapEnd
- .global CustomHeapBegin
- .global CustomHeapEnd
- .global __initial_sp
+ .global _end
.global Reset_Handler
.extern BootEntry
@@ -39,30 +35,32 @@
@*************************************************************************
- .section SectionForStackBottom, "w", %nobits
-StackBottom:
- .word 0
-
- .section SectionForStackTop, "w", %nobits
-__initial_sp:
-StackTop:
- .word 0
-
- .section SectionForHeapBegin, "w", %nobits
-HeapBegin:
- .word 0
-
- .section SectionForHeapEnd, "w", %nobits
-HeapEnd:
- .word 0
-
- .section SectionForCustomHeapBegin, "w", %nobits
-CustomHeapBegin:
- .word 0
-
- .section SectionForCustomHeapEnd, "w", %nobits
-CustomHeapEnd:
- .word 0
+ /* start address for the initialization values of the .data section.
+ defined in linker script */
+ .word _sidata
+ /* start address for the .data section. defined in linker script */
+ .word _sdata
+ /* end address for the .data section. defined in linker script */
+ .word _edata
+ /* start address for the .bss section. defined in linker script */
+ .word _sbss
+ /* end address for the .bss section. defined in linker script */
+ .word _ebss
+ /* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+ /* start address of managed heap */
+ .word HeapBegin
+ /* end address of managed heap */
+ .word HeapEnd
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval : None
+*/
.section i.EntryPoint, "ax", %progbits
@@ -99,10 +97,45 @@ EntryPoint:
.word 0 @ [ UNUSED ]
Reset_Handler:
- @@ reload the stack pointer as there's no returning to the loader
- ldr sp, =__initial_sp
- bl BootstrapCode
- b BootEntry
+ ldr sp, =_estack /* set stack pointer */
+
+ /* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+ CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+ LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+ /* Zero fill the bss segment. */
+ FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+ LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+ /* Call the clock system intitialization function.*/
+ bl SystemInit
+
+ /* Call static constructors */
+ bl __libc_init_array
+
+ /* Call the application's entry point.*/
+ bl main
+ bx lr
.pool
.size Reset_Handler, . - Reset_Handler
diff --git a/DeviceCode/Cores/arm/Processors/CortexMx/TinyHal/GNU_S/FirstEntry.s b/DeviceCode/Cores/arm/Processors/CortexMx/TinyHal/GNU_S/FirstEntry.s
index 8986a5c95..60a9a3ef4 100644
--- a/DeviceCode/Cores/arm/Processors/CortexMx/TinyHal/GNU_S/FirstEntry.s
+++ b/DeviceCode/Cores/arm/Processors/CortexMx/TinyHal/GNU_S/FirstEntry.s
@@ -16,47 +16,33 @@
.thumb
.global EntryPoint
- .global __initial_sp
.global Reset_Handler
- .global StackBottom
- .global StackTop
.global HeapBegin
.global HeapEnd
- .global CustomHeapBegin
- .global CustomHeapEnd
+ .global _end
.global PowerOnReset
- .extern PreStackInit
-
- .extern BootEntry
- .extern BootstrapCode
+ .extern SystemInit
@*************************************************************************
- .section SectionForStackBottom, "w", %nobits
-StackBottom:
- .word 0
-
- .section SectionForStackTop, "w", %nobits
-__initial_sp:
-StackTop:
- .word 0
-
- .section SectionForHeapBegin, "w", %nobits
-HeapBegin:
- .word 0
-
- .section SectionForHeapEnd, "w", %nobits
-HeapEnd:
- .word 0
-
- .section SectionForCustomHeapBegin, "w", %nobits
-CustomHeapBegin:
- .word 0
-
- .section SectionForCustomHeapEnd, "w", %nobits
-CustomHeapEnd:
- .word 0
+ /* start address for the initialization values of the .data section.
+ defined in linker script */
+ .word _sidata
+ /* start address for the .data section. defined in linker script */
+ .word _sdata
+ /* end address for the .data section. defined in linker script */
+ .word _edata
+ /* start address for the .bss section. defined in linker script */
+ .word _sbss
+ /* end address for the .bss section. defined in linker script */
+ .word _ebss
+ /* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+ /* start address of managed heap */
+ .word HeapBegin
+ /* end address of managed heap */
+ .word HeapEnd
@ Power On Reset vector table for the device
@ This is placed at physical address 0 by the
@@ -68,7 +54,7 @@ CustomHeapEnd:
.section SectionForPowerOnReset, "x", %progbits
PowerOnReset:
- .word __initial_sp
+ .word _estack
.word Reset_Handler @ Reset
.word Fault_Handler @ NMI
.word Fault_Handler @ Hard Fault
@@ -86,8 +72,45 @@ PowerOnReset:
.section i.EntryPoint, "ax", %progbits
EntryPoint:
Reset_Handler:
- bl BootstrapCode
- b BootEntry
+ ldr sp, =_estack /* set stack pointer */
+
+ /* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+ /* Call the clock system intitialization function.*/
+ bl SystemInit
+
+ /* Call static constructors */
+ bl __libc_init_array
+
+ /* Call the application's entry point.*/
+ bl main
+ bx lr
.pool
.size Reset_Handler, . - Reset_Handler
diff --git a/DeviceCode/Cores/arm/Processors/CortexMx/TinyHal/GNU_S/VectorTable_Template.s b/DeviceCode/Cores/arm/Processors/CortexMx/TinyHal/GNU_S/VectorTable_Template.s
index acd395e9f..0ba1215dc 100644
--- a/DeviceCode/Cores/arm/Processors/CortexMx/TinyHal/GNU_S/VectorTable_Template.s
+++ b/DeviceCode/Cores/arm/Processors/CortexMx/TinyHal/GNU_S/VectorTable_Template.s
@@ -25,7 +25,7 @@
.thumb
@ Initial Stack pointer for power on reset
- .extern __initial_sp
+ .extern _estack
@ Import standard Cortex-M handlers
.extern Reset_Handler
@@ -145,7 +145,7 @@
; The first 16 entries are all architecturally defined by ARM
ARM_Vectors:
- .long __initial_sp @ Top of Stack
+ .long _estack @ Top of Stack
.long Reset_Handler @ Reset Handler
.long NMI_Handler @ NMI Handler
.long HardFault_Handler @ Hard Fault Handler
diff --git a/DeviceCode/Drivers/BlockStorage/Flash/AM29DL_16/AM29DL_16_driver.cpp b/DeviceCode/Drivers/BlockStorage/Flash/AM29DL_16/AM29DL_16_driver.cpp
index 7c6d2c0a4..7ee1f6393 100644
--- a/DeviceCode/Drivers/BlockStorage/Flash/AM29DL_16/AM29DL_16_driver.cpp
+++ b/DeviceCode/Drivers/BlockStorage/Flash/AM29DL_16/AM29DL_16_driver.cpp
@@ -210,7 +210,7 @@ BOOL __section("SectionForFlashOperations") AM29DL_16_BS_Driver::Write(void* con
ByteAddress addrEnd = Address + NumBytes;
UINT32 index = 0;
- pBuf = (BYTE*)private_malloc(bytesPerBlock);
+ pBuf = (BYTE*)malloc(bytesPerBlock);
if(pBuf == NULL)
{
@@ -262,9 +262,9 @@ BOOL __section("SectionForFlashOperations") AM29DL_16_BS_Driver::Write(void* con
regionEnd = deviceInfo->Regions[region].Start + deviceInfo->Regions[region].Size();
bytesPerBlock = deviceInfo->Regions[region].BytesPerBlock;
- private_free(pBuf);
+ free(pBuf);
- pBuf = (BYTE*)private_malloc(bytesPerBlock);
+ pBuf = (BYTE*)malloc(bytesPerBlock);
if(pBuf == NULL)
{
@@ -277,7 +277,7 @@ BOOL __section("SectionForFlashOperations") AM29DL_16_BS_Driver::Write(void* con
if(pBuf != NULL)
{
- private_free(pBuf);
+ free(pBuf);
}
return fRet;
diff --git a/DeviceCode/Drivers/BlockStorage/Flash/I28F_16/I28F_16_driver.cpp b/DeviceCode/Drivers/BlockStorage/Flash/I28F_16/I28F_16_driver.cpp
index 931b6e570..879d7377b 100644
--- a/DeviceCode/Drivers/BlockStorage/Flash/I28F_16/I28F_16_driver.cpp
+++ b/DeviceCode/Drivers/BlockStorage/Flash/I28F_16/I28F_16_driver.cpp
@@ -263,7 +263,7 @@ BOOL __section("SectionForFlashOperations")I28F_16_BS_Driver::Write(void* contex
ByteAddress addrEnd = Address + NumBytes;
UINT32 index = 0;
- pBuf = (BYTE*)private_malloc(bytesPerBlock);
+ pBuf = (BYTE*)malloc(bytesPerBlock);
if(pBuf == NULL) return FALSE;
@@ -312,9 +312,9 @@ BOOL __section("SectionForFlashOperations")I28F_16_BS_Driver::Write(void* contex
regionEnd = deviceInfo->Regions[region].Start + deviceInfo->Regions[region].Size();
bytesPerBlock = deviceInfo->Regions[region].BytesPerBlock;
- private_free(pBuf);
+ free(pBuf);
- pBuf = (BYTE*)private_malloc(bytesPerBlock);
+ pBuf = (BYTE*)malloc(bytesPerBlock);
if(pBuf == NULL) fRet = FALSE;
}
@@ -324,7 +324,7 @@ BOOL __section("SectionForFlashOperations")I28F_16_BS_Driver::Write(void* contex
if(pBuf != NULL)
{
- private_free(pBuf);
+ free(pBuf);
}
return fRet;
diff --git a/DeviceCode/Drivers/BlockStorage/Flash/SST39WF_16/SST39WF_16_driver.cpp b/DeviceCode/Drivers/BlockStorage/Flash/SST39WF_16/SST39WF_16_driver.cpp
index eca0c9773..3748d7024 100644
--- a/DeviceCode/Drivers/BlockStorage/Flash/SST39WF_16/SST39WF_16_driver.cpp
+++ b/DeviceCode/Drivers/BlockStorage/Flash/SST39WF_16/SST39WF_16_driver.cpp
@@ -236,7 +236,7 @@ BOOL __section("SectionForFlashOperations")SST39WF_16_BS_Driver::Write(void* con
ByteAddress addrEnd = Address + NumBytes;
UINT32 index = 0;
- pBuf = (BYTE*)private_malloc(bytesPerBlock);
+ pBuf = (BYTE*)malloc(bytesPerBlock);
if(pBuf == NULL) return FALSE;
@@ -283,9 +283,9 @@ BOOL __section("SectionForFlashOperations")SST39WF_16_BS_Driver::Write(void* con
regionEnd = deviceInfo->Regions[region].Start + deviceInfo->Regions[region].Size();
bytesPerBlock = deviceInfo->Regions[region].BytesPerBlock;
- private_free(pBuf);
+ free(pBuf);
- pBuf = (BYTE*)private_malloc(bytesPerBlock);
+ pBuf = (BYTE*)malloc(bytesPerBlock);
if(pBuf == NULL) fRet = FALSE;
}
@@ -295,7 +295,7 @@ BOOL __section("SectionForFlashOperations")SST39WF_16_BS_Driver::Write(void* con
if(pBuf != NULL)
{
- private_free(pBuf);
+ free(pBuf);
}
return fRet;
diff --git a/DeviceCode/Drivers/BlockStorage/WearLeveling/BS_WearLeveling_Driver.cpp b/DeviceCode/Drivers/BlockStorage/WearLeveling/BS_WearLeveling_Driver.cpp
index 52c7c4a7c..cc679afe2 100644
--- a/DeviceCode/Drivers/BlockStorage/WearLeveling/BS_WearLeveling_Driver.cpp
+++ b/DeviceCode/Drivers/BlockStorage/WearLeveling/BS_WearLeveling_Driver.cpp
@@ -107,12 +107,6 @@ BOOL BS_WearLeveling_Driver::InitializeDevice(void *context)
config->BlockIndexMask = 0x80000000;
- // verify that we have simple heap support
- void* tmp = SimpleHeap_Allocate(4);
-
- if(NULL == tmp) { _WEAR_LEVEL_ASSERT(FALSE); return FALSE; }
- else { SimpleHeap_Release(tmp); }
-
//
// Block index mas is used to determine block map addressing
//
@@ -1777,7 +1771,8 @@ BOOL BS_WearLeveling_Driver::WriteToSector(BS_WearLeveling_Config* config, ByteA
//
// we only need a new sector if we are moving any bits from 0 -> 1
//
- //if(origPhyMeta.IsSectorDirty())
+ //if(origPhyMeta.IsSectorDirty())
+
//{
// fReadModifyNeeded = TRUE;
//}
diff --git a/DeviceCode/Drivers/FS/FAT/FAT_SectorCache.cpp b/DeviceCode/Drivers/FS/FAT/FAT_SectorCache.cpp
index 5db790593..46d30499d 100644
--- a/DeviceCode/Drivers/FS/FAT/FAT_SectorCache.cpp
+++ b/DeviceCode/Drivers/FS/FAT/FAT_SectorCache.cpp
@@ -70,7 +70,7 @@ void FAT_SectorCache::Uninitialize()
{
FlushSector( cacheLine );
- private_free( cacheLine->m_buffer );
+ free( cacheLine->m_buffer );
cacheLine->m_buffer = NULL;
cacheLine->m_flags = 0;
@@ -101,7 +101,7 @@ BYTE* FAT_SectorCache::GetSector( UINT32 sectorIndex, BOOL useLRU, BOOL forWrite
if(!cacheLine->m_buffer)
{
- cacheLine->m_buffer = (BYTE*)private_malloc( SECTORCACHE_LINESIZE );
+ cacheLine->m_buffer = (BYTE*)malloc( SECTORCACHE_LINESIZE );
if(!cacheLine->m_buffer) return NULL;
}
@@ -113,7 +113,7 @@ BYTE* FAT_SectorCache::GetSector( UINT32 sectorIndex, BOOL useLRU, BOOL forWrite
if(!m_blockStorageDevice->Read( cacheLine->m_bsByteAddress, SECTORCACHE_LINESIZE, cacheLine->m_buffer ))
{
- private_free( cacheLine->m_buffer );
+ free( cacheLine->m_buffer );
cacheLine->m_buffer = NULL;
diff --git a/DeviceCode/Drivers/MFUpdate/MicroBooterUpdate.cpp b/DeviceCode/Drivers/MFUpdate/MicroBooterUpdate.cpp
index a7dce78b0..0953cb021 100644
--- a/DeviceCode/Drivers/MFUpdate/MicroBooterUpdate.cpp
+++ b/DeviceCode/Drivers/MFUpdate/MicroBooterUpdate.cpp
@@ -118,7 +118,7 @@ BOOL MicroBooterUpdateProvider::InstallUpdate( MFUpdate* pUpdate, UINT8* pValida
if(!isXIP)
{
- headerBuffer = (BYTE*)private_malloc( headerInBytes ); if(!headerBuffer) return FALSE;
+ headerBuffer = (BYTE*)malloc( headerInBytes ); if(!headerBuffer) return FALSE;
memset( headerBuffer, 0, headerInBytes );
}
@@ -157,7 +157,7 @@ BOOL MicroBooterUpdateProvider::InstallUpdate( MFUpdate* pUpdate, UINT8* pValida
stream.Seek( AssemblySizeInByte );
}
- if(!isXIP) private_free( headerBuffer );
+ if(!isXIP) free( headerBuffer );
}
while(stream.NextStream());
diff --git a/DeviceCode/Drivers/Stubs/TempForGCC/missFunctions.cpp b/DeviceCode/Drivers/Stubs/TempForGCC/missFunctions.cpp
index 67b806373..625af85a8 100644
--- a/DeviceCode/Drivers/Stubs/TempForGCC/missFunctions.cpp
+++ b/DeviceCode/Drivers/Stubs/TempForGCC/missFunctions.cpp
@@ -54,7 +54,8 @@ double pow(double x, double y)
}
double floor(double x)
-{
+{
+
if (x >0)
return 1;
else
@@ -63,7 +64,8 @@ double floor(double x)
double fmod(double x, double y)
-{
+{
+
if (x >0)
return 1;
else
@@ -87,11 +89,6 @@ void longjmp (jmp_buf env, int val)
}
#endif
-////////////////////////
-
-#define malloc(y) private_malloc(y)
-
-#define free(x) private_free((void*)x)
////////////////////
@@ -120,7 +117,8 @@ void * memset ( void * dst, int value, size_t len )
return dst;
}
-void * memmove ( void * dst, const void * src, size_t num )
+void * memmove ( void * dst, const void * src, size_t num )
+
{
if (dst==NULL)
diff --git a/DeviceCode/Initialization/tinyhal.cpp b/DeviceCode/Initialization/tinyhal.cpp
index 48f42b66d..c7a4a6c7c 100644
--- a/DeviceCode/Initialization/tinyhal.cpp
+++ b/DeviceCode/Initialization/tinyhal.cpp
@@ -10,205 +10,14 @@
//--//
-// we need this to force inclusion from library at link time
-#pragma import(EntryPoint)
-
-
#undef TRACE_ALWAYS
#define TRACE_ALWAYS 0x00000001
#undef DEBUG_TRACE
#define DEBUG_TRACE (TRACE_ALWAYS)
-//--//
-
-#if !defined(BUILD_RTM) && !defined(PLATFORM_ARM_OS_PORT)
-
-UINT32 Stack_MaxUsed()
-{
- // this is the value we check for stack overruns
- const UINT32 StackCheckVal = 0xBAADF00D;
-
- size_t size = (size_t)&StackTop - (size_t)&StackBottom;
- UINT32* ptr = (UINT32*)&StackBottom;
-
- DEBUG_TRACE1(TRACE_ALWAYS, "Stack Max = %d\r\n", size);
-
- while(*ptr == StackCheckVal)
- {
- size -= 4;
- ptr++;
- }
-
- DEBUG_TRACE1(TRACE_ALWAYS, "Stack Used = %d\r\n", size);
-
- return size;
-}
-
-#endif // !defined(BUILD_RTM)
//--//
-// this is the first C function called after bootstrapping ourselves into ram
-
-// these define the region to zero initialize
-extern UINT32 Image$$ER_RAM_RW$$ZI$$Base;
-extern UINT32 Image$$ER_RAM_RW$$ZI$$Length;
-
-// here is the execution address/length of code to move from FLASH to RAM
-#define IMAGE_RAM_RO_BASE Image$$ER_RAM_RO$$Base
-#define IMAGE_RAM_RO_LENGTH Image$$ER_RAM_RO$$Length
-
-extern UINT32 IMAGE_RAM_RO_BASE;
-extern UINT32 IMAGE_RAM_RO_LENGTH;
-
-// here is the execution address/length of data to move from FLASH to RAM
-extern UINT32 Image$$ER_RAM_RW$$Base;
-extern UINT32 Image$$ER_RAM_RW$$Length;
-
-// here is the load address of the RAM code/data
-#define LOAD_RAM_RO_BASE Load$$ER_RAM_RO$$Base
-
-extern UINT32 LOAD_RAM_RO_BASE;
-extern UINT32 Load$$ER_RAM_RW$$Base;
-
-//--//
-
-#if defined(TARGETLOCATION_RAM)
-
-extern UINT32 Load$$ER_RAM$$Base;
-extern UINT32 Image$$ER_RAM$$Length;
-
-#elif defined(TARGETLOCATION_FLASH)
-
-extern UINT32 Load$$ER_FLASH$$Base;
-extern UINT32 Image$$ER_FLASH$$Length;
-
-#else
- !ERROR
-#endif
-
-UINT32 LOAD_IMAGE_Start;
-UINT32 LOAD_IMAGE_Length;
-UINT32 LOAD_IMAGE_CalcCRC;
-
-//
-// The ARM linker is not keeping FirstEntry.obj (and EntryPoint) for RTM builds of NativeSample (possibly others)
-// The --keep FirstEntry.obj linker option also does not work, however, this unused method call to EntryPoint does the trick.
-//
-void KEEP_THE_LINKER_HAPPY_SINCE_KEEP_IS_NOT_WORKING()
-{
- EntryPoint();
-}
-
-//--//
-
-#pragma arm section code = "SectionForBootstrapOperations"
-
-static void __section("SectionForBootstrapOperations") Prepare_Copy( UINT32* src, UINT32* dst, UINT32 len )
-{
- if(dst != src)
- {
- INT32 extraLen = len & 0x00000003;
- len = len & 0xFFFFFFFC;
-
- while(len != 0)
- {
- *dst++ = *src++;
-
- len -= 4;
- }
-
- // thumb2 code can be multiples of 2...
-
- UINT8 *dst8 = (UINT8*) dst, *src8 = (UINT8*) src;
-
- while (extraLen > 0)
- {
- *dst8++ = *src8++;
-
- extraLen--;
- }
- }
-}
-
-static void __section("SectionForBootstrapOperations") Prepare_Zero( UINT32* dst, UINT32 len )
-{
- INT32 extraLen = len & 0x00000003;
- len = len & 0xFFFFFFFC;
-
- while(len != 0)
- {
- *dst++ = 0;
-
- len -= 4;
- }
-
- // thumb2 code can be multiples of 2...
-
- UINT8 *dst8 = (UINT8*) dst;
-
- while (extraLen > 0)
- {
- *dst8++ = 0;
-
- extraLen--;
- }
-}
-
-void __section("SectionForBootstrapOperations") PrepareImageRegions()
-{
- //
- // Copy RAM RO regions into proper location.
- //
- {
- UINT32* src = (UINT32*)&LOAD_RAM_RO_BASE;
- UINT32* dst = (UINT32*)&IMAGE_RAM_RO_BASE;
- UINT32 len = (UINT32 )&IMAGE_RAM_RO_LENGTH;
-
- Prepare_Copy( src, dst, len );
- }
-
- //
- // Copy RAM RW regions into proper location.
- //
- {
- UINT32* src = (UINT32*)&Load$$ER_RAM_RW$$Base;
- UINT32* dst = (UINT32*)&Image$$ER_RAM_RW$$Base;
- UINT32 len = (UINT32)&Image$$ER_RAM_RW$$Length;
-
- Prepare_Copy( src, dst, len );
- }
-
- //
- // Initialize RAM ZI regions.
- //
- {
- UINT32* dst = (UINT32*)&Image$$ER_RAM_RW$$ZI$$Base;
- UINT32 len = (UINT32 )&Image$$ER_RAM_RW$$ZI$$Length;
-
- Prepare_Zero( dst, len );
- }
-}
-
-#pragma arm section code
-
-//--//
-
-static void InitCRuntime()
-{
-#if (defined(HAL_REDUCESIZE) || defined(PLATFORM_EMULATED_FLOATINGPOINT))
-
- // Don't initialize floating-point on small builds.
-
-#else
-
-#if !defined(__GNUC__)
- _fp_init();
-#endif
-
- setlocale( LC_ALL, "" );
-#endif
-}
#if !defined(BUILD_RTM)
static UINT32 g_Boot_RAMConstants_CRC = 0;
@@ -309,7 +118,7 @@ void HAL_EnterBooterMode()
::Watchdog_ResetCounter();
- BYTE *data = (BYTE*) private_malloc(pBlockRegionInfo->BytesPerBlock);
+ BYTE *data = (BYTE*) malloc(pBlockRegionInfo->BytesPerBlock);
if(data != NULL)
{
@@ -338,7 +147,7 @@ void HAL_EnterBooterMode()
// write back to sector, as we only change one bit from 0 to 1, no need to erase sector
bRet = (TRUE == pBlockDevice->Write( configSectAddress, pBlockRegionInfo->BytesPerBlock, data, FALSE ));
- private_free(data);
+ free(data);
}
}
@@ -349,20 +158,31 @@ void HAL_EnterBooterMode()
bool g_fDoNotUninitializeDebuggerPort = false;
void HAL_Initialize()
-{
+{
+#if defined(PLATFORM_ARM_OS_PORT)
+ // Interrupts must be enabled to handle calls to OS
+ // (Network stack uses the CMSIS-RTX OS, which uses
+ // SVC calls, which will hard fault if the interrupts
+ // are disabled at the Svc instruction )
+ // SystemInit handles this for the startup from reset
+ // However, this is also called from the CLR when doing
+ // a soft reboot.
+ __enable_irq();
+#endif
+
HAL_CONTINUATION::InitializeList();
HAL_COMPLETION ::InitializeList();
- HAL_Init_Custom_Heap();
-
Time_Initialize();
Events_Initialize();
CPU_GPIO_Initialize();
CPU_SPI_Initialize();
+#if !defined(PLATFORM_ARM_OS_PORT)
// this is the place where interrupts are enabled after boot for the first time after boot
ENABLE_INTERRUPTS();
+#endif
// have to initialize the blockstorage first, as the USB device needs to update the configure block
@@ -483,87 +303,29 @@ void HAL_Uninitialize()
extern "C"
{
-
-void BootEntry()
+// defined as weak to allow it to be overriden by equivalent function at Solution level
+__attribute__((weak)) int main(void)
{
-
-#if (defined(GCCOP) && defined(COMPILE_THUMB))
-
-// the IRQ_Handler routine generated from the compiler is incorrect, the return address LR has been decrement twice
-// it decrements LR at the first instruction of IRQ_handler and then before return, it decrements LR again.
-// temporary fix is at the ARM_Vector ( IRQ), make it jump to 2nd instruction of IRQ_handler to skip teh first subs LR, LR #4;
-//
- volatile int *ptr;
- ptr =(int*) 0x28;
- *ptr = *ptr +4;
-#endif
-
-
-#if !defined(BUILD_RTM) && !defined(PLATFORM_ARM_OS_PORT)
- {
- int marker;
- int* ptr = &marker - 1; // This will point to the current top of the stack.
- int* end = &StackBottom;
-
- while(ptr >= end)
- {
- *ptr-- = 0xBAADF00D;
- }
- }
-#endif
-
- // these are needed for patch access
-
-#if defined(TARGETLOCATION_RAM)
-
- LOAD_IMAGE_Start = (UINT32)&Load$$ER_RAM$$Base;
- LOAD_IMAGE_Length = (UINT32)&Image$$ER_RAM$$Length;
-
-#elif defined(TARGETLOCATION_FLASH)
-
- LOAD_IMAGE_Start = (UINT32)&Load$$ER_FLASH$$Base;
- LOAD_IMAGE_Length = (UINT32)&Image$$ER_FLASH$$Length;
-
-#else
- !ERROR
-#endif
-
- InitCRuntime();
-
- LOAD_IMAGE_Length += (UINT32)&IMAGE_RAM_RO_LENGTH + (UINT32)&Image$$ER_RAM_RW$$Length;
-
-#if !defined(BUILD_RTM)
- g_Boot_RAMConstants_CRC = Checksum_RAMConstants();
-#endif
-
-
- CPU_Initialize();
-
HAL_Time_Initialize();
HAL_Initialize();
-#if !defined(BUILD_RTM)
- DEBUG_TRACE4( STREAM_LCD, ".NetMF v%d.%d.%d.%d\r\n", VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION);
- DEBUG_TRACE3(TRACE_ALWAYS, "%s, Build Date:\r\n\t%s %s\r\n", HalName, __DATE__, __TIME__);
-#if defined(__GNUC__)
- DEBUG_TRACE1(TRACE_ALWAYS, "GNU Compiler version %d\r\n", __GNUC__);
-#else
- DEBUG_TRACE1(TRACE_ALWAYS, "ARM Compiler version %d\r\n", __ARMCC_VERSION);
-#endif
- UINT8* BaseAddress;
- UINT32 SizeInBytes;
- HeapLocation( BaseAddress, SizeInBytes );
- memset ( BaseAddress, 0, SizeInBytes );
-
- lcd_printf("\f");
+#if !defined(BUILD_RTM)
+ //DEBUG_TRACE4( STREAM_LCD, ".NetMF v%d.%d.%d.%d\r\n", VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION);
+ //DEBUG_TRACE3(TRACE_ALWAYS, "%s, Build Date:\r\n\t%s %s\r\n", HalName, __DATE__, __TIME__);
+
+ #if defined(__GNUC__)
+ //DEBUG_TRACE1(TRACE_ALWAYS, "GNU Compiler version %d\r\n", __GNUC__);
+ #else
+ //DEBUG_TRACE1(TRACE_ALWAYS, "ARM Compiler version %d\r\n", __ARMCC_VERSION);
+ #endif
- lcd_printf("%-15s\r\n", HalName);
- lcd_printf("%-15s\r\n", "Build Date:");
- lcd_printf(" %-13s\r\n", __DATE__);
- lcd_printf(" %-13s\r\n", __TIME__);
+ debug_printf("%-15s\r\n", HalName);
+ debug_printf("%-15s\r\n", "Build Date:");
+ debug_printf(" %-13s\r\n", __DATE__);
+ debug_printf(" %-13s\r\n", __TIME__);
#endif // !defined(BUILD_RTM)
@@ -575,20 +337,15 @@ void BootEntry()
#endif
}
- //
- // the runtime is by default using a watchdog
- //
-
Watchdog_GetSetTimeout ( WATCHDOG_TIMEOUT , TRUE );
Watchdog_GetSetBehavior( WATCHDOG_BEHAVIOR, TRUE );
Watchdog_GetSetEnabled ( WATCHDOG_ENABLE, TRUE );
-
-
+
// HAL initialization completed. Interrupts are enabled. Jump to the Application routine
ApplicationEntryPoint();
lcd_printf("\fmain exited!!???. Halting CPU\r\n");
- debug_printf("main exited!!???. Halting CPU\r\n");
+ //debug_printf("main exited!!???. Halting CPU\r\n");
#if defined(BUILD_RTM)
CPU_Reset();
@@ -599,6 +356,29 @@ void BootEntry()
} // extern "C"
+extern "C" void BootstrapCode();
+
+// performs base level system initialization
+// This typically consists of setting up clocks
+// and PLLs along with any external memory needed
+// to boot.
+// NOTE:
+// It is important to keep in mind that this is
+// called *BEFORE* any C/C++ runtime initialization
+// That is, zero init of uninitialied writeable data
+// and copying of initialized values for initialized
+// writeable data have not yet occured. Thus, any code
+// called from SystemInit must not use or rely on
+// initializtion having occured. This also precludes
+// the use of any OS provided primitives and support
+// as the kernel isn't initialized yet either.
+extern "C" void SystemInit()
+{
+ BootstrapCode();
+ CPU_Initialize();
+ __enable_irq();
+}
+
//--//
#if !defined(BUILD_RTM)
@@ -701,78 +481,3 @@ BOOL SystemState_Query( SYSTEM_STATE State )
return SystemState_QueryNoLock( State );
}
-
-//--//
-
-#if !defined(BUILD_RTM)
-
-UINT32 Checksum_RAMConstants()
-{
- UINT32* RAMConstants = (UINT32*)&IMAGE_RAM_RO_BASE;
- UINT32 Length = (UINT32 )&IMAGE_RAM_RO_LENGTH;
-
- UINT32 CRC;
-
- // start with Vector area CRC
- CRC = SUPPORT_ComputeCRC( NULL, 0x00000020, 0 );
-
- // add the big block of RAM constants to CRC
- CRC = SUPPORT_ComputeCRC( RAMConstants, Length, CRC );
-
- return CRC;
-}
-
-void Verify_RAMConstants( void* arg )
-{
- BOOL BreakpointOnError = (BOOL)arg;
-
- //debug_printf("RAMC\r\n");
-
- UINT32 CRC = Checksum_RAMConstants();
-
- if(CRC != g_Boot_RAMConstants_CRC)
- {
- hal_printf( "RAMC CRC:%08x!=%08x\r\n", CRC, g_Boot_RAMConstants_CRC );
-
- UINT32* ROMConstants = (UINT32*)&LOAD_RAM_RO_BASE;
- UINT32* RAMConstants = (UINT32*)&IMAGE_RAM_RO_BASE;
- UINT32 Length = (UINT32 )&IMAGE_RAM_RO_LENGTH;
- BOOL FoundMismatch = FALSE;
-
- for(int i = 0; i < Length; i += 4)
- {
- if(*RAMConstants != *ROMConstants)
- {
- hal_printf( "RAMC %08x:%08x!=%08x\r\n", (UINT32) RAMConstants, *RAMConstants, *ROMConstants );
-
- if(!FoundMismatch) lcd_printf( "\fRAMC:%08x\r\n", (UINT32)RAMConstants ); // first one only to LCD
- FoundMismatch = TRUE;
- }
-
- RAMConstants++;
- ROMConstants++;
- }
-
- if(!FoundMismatch)
- {
- // the vector area must have been trashed
- lcd_printf("\fRAMC:%08x\r\n", (UINT32) NULL);
- RAMConstants = (UINT32*)NULL;
-
- for(int i = 0; i < 32; i += 4)
- {
- hal_printf( "RAMC %02x:%08x\r\n", i, *RAMConstants );
- lcd_printf( "%02x:%08x\r\n" , i, *RAMConstants++ );
- }
- }
-
- DebuggerPort_Flush( HalSystemConfig.DebugTextPort );
-
- if(BreakpointOnError)
- {
- HARD_BREAKPOINT();
- }
- }
-}
-
-#endif // !defined(BUILD_RTM)
diff --git a/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_Bootstrap/GNU_S/VectorTable.s b/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_Bootstrap/GNU_S/VectorTable.s
index b99e0a15e..490dd7e8f 100644
--- a/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_Bootstrap/GNU_S/VectorTable.s
+++ b/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_Bootstrap/GNU_S/VectorTable.s
@@ -24,7 +24,7 @@
.arch armv7-m
@ Initial Stack pointer for power on reset
- .extern __initial_sp
+ .extern _estack
@ Import standard Cortex-M handlers
.extern Reset_Handler
@@ -144,7 +144,7 @@
@ The first 16 entries are all architecturally defined by ARM
ARM_Vectors:
- .long __initial_sp @ Top of Stack
+ .long _estack @ Top of Stack
.long Reset_Handler @ Reset Handler
.long NMI_Handler @ NMI Handler
.long HardFault_Handler @ Hard Fault Handler
diff --git a/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_Bootstrap/STM32F4_bootstrap.cpp b/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_Bootstrap/STM32F4_bootstrap.cpp
index 779e4dab8..f6af2a787 100644
--- a/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_Bootstrap/STM32F4_bootstrap.cpp
+++ b/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_Bootstrap/STM32F4_bootstrap.cpp
@@ -285,9 +285,7 @@ void __section("SectionForBootstrapOperations") STM32F4_BootstrapCode()
__section("SectionForBootstrapOperations") void BootstrapCode()
{
STM32F4_BootstrapCode();
-
- PrepareImageRegions();
-
+
BootstrapCode_GPIO();
}
diff --git a/DeviceCode/include/tinyhal.h b/DeviceCode/include/tinyhal.h
index 12df2f1c7..f9d0160cd 100644
--- a/DeviceCode/include/tinyhal.h
+++ b/DeviceCode/include/tinyhal.h
@@ -1155,119 +1155,9 @@ extern INT64 s_timewarp_compensate;
extern int HeapBegin;
extern int HeapEnd;
-extern int CustomHeapBegin;
-extern int CustomHeapEnd;
-extern int StackBottom;
-extern int StackTop;
-
-#if !defined(BUILD_RTM)
-
-// Registers[n] == Rn in ARM terms, R13=sp, R14=lr, R15=pc
-typedef void (*AbortHandlerFunc)(UINT32 cpsr, UINT32 Registers[16]);
-
-extern "C"
-{
-void StackOverflow( UINT32 sp );
-
-void NULL_Pointer_Write();
-}
-
-UINT32 Stack_MaxUsed();
-
-#endif
#endif // defined(PLATFORM_ARM)
-//--//
-
-// Simple Heap is for use by Porting Kit users who need private memory allocation.
-/*************************************************************************************
-**
-** Function: SimpleHeap_Allocate
-**
-** Synopsis: Initializes simple heap from supplied buffer.
-** Pointer to buffer is saved in global variable.
-** Later is used for allocation of blocks by SimpleHeap_Allocate
-**
-** Arguments: [pHeapBuffer] - Pointer to heap buffer. This pointer is saved in global variable,
-** later used by SimpleHeap_* function.
-** [pHeapBuffer] - Size of memory block pointed by pHeapBuffer
-**
-**************************************************************************************/
-void SimpleHeap_Initialize( void* pHeapBuffer, UINT32 heapBuufferSize );
-
-/**********************************************************************
-**
-** Function: SimpleHeap_Allocate
-**
-** Synopsis: Allocates block of memory from heap buffer initialized by SimpleHeap_Initialize
-**
-**
-** Arguments: [len] - Size of block to allocate.
-**
-** Returns: Pointer to newly allocated memory
- or NULL if there is no free memory to accomodate block of size len
-**********************************************************************/
-void* SimpleHeap_Allocate ( size_t len );
-
-/**********************************************************************
-**
-** Function: SimpleHeap_Release
-**
-** Synopsis: Releases memory block allocated by SimpleHeap_Allocate
-**
-**
-** Arguments: [pHeapBlock] - Memory block to release.
-**
-**********************************************************************/
-void SimpleHeap_Release ( void* pHeapBlock );
-
-
-/**********************************************************************
-**
-** Function: SimpleHeap_ReAllocate
-**
-** Synopsis: Reallocates memory on an existing pointer and copies bck the
-** data
-**
-** Arguments: [pHeapBlock] - Memory block to reallocate.
-** Arguments: [len] - Size of block to allocate.
-**
-**********************************************************************/
-void* SimpleHeap_ReAllocate( void* pHeapBlock, size_t len );
-
-/**********************************************************************
-**
-** Function: SimpleHeap_IsAllocated
-**
-** Synopsis: Checks if pHeapBlock points to memory block allocated by SimpleHeap_Allocate
-**
-** Arguments: [pHeapBlock] - Memory block to release.
-**
-** Returns: TRUE if pHeapBlock points to memory allocated, FALSE otherwise.
-**********************************************************************/
-BOOL SimpleHeap_IsAllocated( void* pHeapBlock );
-
-/**********************************************************************
-**
-** Function: HAL_Init_Custom_Heap
-**
-** Synopsis: Initializes simple heap with memory buffer provided by CustomHeapLocation function.
-**
-**********************************************************************/
-inline void HAL_Init_Custom_Heap()
-{
- UINT8* BaseAddress = 0;
- UINT32 SizeInBytes = 0;
-
- // Retrieve location for Custom Heap. The location is defined in scatter file.
- CustomHeapLocation( BaseAddress, SizeInBytes );
-
- // Initialize custom heap with heap block returned from CustomHeapLocation
- SimpleHeap_Initialize( BaseAddress, SizeInBytes );
-}
-
-
//--//
// hal cleanup for CLR reboot
@@ -1303,7 +1193,7 @@ template __inline void private_release( T& ref )
{
ref = NULL;
- private_free( ptr );
+ free( ptr );
}
}
@@ -1311,25 +1201,6 @@ template __inline void private_release( T& ref )
__inline void* ReAllocate_NotImplemented( void * ptr, size_t len ) { ASSERT(FALSE); return NULL; }
-//--//
-
-#define HAL_DECLARE_CUSTOM_HEAP(allocFtn,freeFtn,reallocFtn) \
- extern "C" { \
- void* private_malloc ( size_t len ) { return allocFtn ( len ); } \
- void private_free ( void* ptr ) { freeFtn ( ptr ); } \
- void* private_realloc( void* ptr, size_t len ) { return reallocFtn( ptr, len ); } \
- }
-
-#define HAL_DECLARE_NULL_HEAP() \
- extern "C" { \
- void* private_malloc ( size_t len ) { return NULL; } \
- void private_free ( void* ptr ) { } \
- void* private_realloc( void * ptr, size_t len ) { return NULL; } \
- }
-
-
-//--//
-
extern UINT32 LOAD_IMAGE_Start;
extern UINT32 LOAD_IMAGE_Length;
extern UINT32 LOAD_IMAGE_CRC;
diff --git a/DeviceCode/pal/COM/usb/usb.cpp b/DeviceCode/pal/COM/usb/usb.cpp
index 56ea0c0ab..a3acae6d0 100644
--- a/DeviceCode/pal/COM/usb/usb.cpp
+++ b/DeviceCode/pal/COM/usb/usb.cpp
@@ -330,13 +330,13 @@ int USB_Driver::Configure( int Controller, const USB_DYNAMIC_CONFIGURATION* Conf
//
if(State->Configuration != &UsbDefaultConfiguration)
{
- private_free((void*)State->Configuration);
+ free((void*)State->Configuration);
}
//
// Make sure that we allocate the native configuration buffer, the one passed in will be garbage collected
//
- State->Configuration = (USB_DYNAMIC_CONFIGURATION*)private_malloc(Length);
+ State->Configuration = (USB_DYNAMIC_CONFIGURATION*)malloc(Length);
//
diff --git a/DeviceCode/pal/OpenSSL/OpenSSL_1_0_0/tinyclr/ssl_types.h b/DeviceCode/pal/OpenSSL/OpenSSL_1_0_0/tinyclr/ssl_types.h
index b598573c4..d6c0fd37b 100644
--- a/DeviceCode/pal/OpenSSL/OpenSSL_1_0_0/tinyclr/ssl_types.h
+++ b/DeviceCode/pal/OpenSSL/OpenSSL_1_0_0/tinyclr/ssl_types.h
@@ -65,7 +65,7 @@ typedef int _ssize_t;
typedef int ssize_t;
#endif
-#if defined(LITTLE_ENDIAN)
+#if defined(NETMF_TARGET_LITTLE_ENDIAN)
#define SSL_LONG_LITTLE_ENDIAN(x) (x)
#define SSL_ntohl(x) SOCK_htonl(x)
#else
@@ -299,9 +299,9 @@ extern int hal_fprintf_ssl(OPENSSL_TYPE__FILE* x, const char* format, ... );
#define TINYCLR_SSL_QSORT qsort
#define TINYCLR_SSL_EXIT(x) if (x==0) return else TINYCLR_SSL_ASSERT(x)
#define TINYCLR_SSL_ABORT() {TINYCLR_SSL_PRINTF("%s:%d",__FILE__,__LINE__);TINYCLR_SSL_ASSERT(1);}
-#define TINYCLR_SSL_MALLOC private_malloc
-#define TINYCLR_SSL_FREE private_free
-#define TINYCLR_SSL_REALLOC private_realloc
+#define TINYCLR_SSL_MALLOC malloc
+#define TINYCLR_SSL_FREE free
+#define TINYCLR_SSL_REALLOC realloc
#define TINYCLR_SSL_GETENV(x) (NULL)
#else
#define TINYCLR_SSL_STRCAT strcat
diff --git a/DeviceCode/pal/SimpleHeap/SimpleHeap.cpp b/DeviceCode/pal/SimpleHeap/SimpleHeap.cpp
deleted file mode 100644
index f64a9fa16..000000000
--- a/DeviceCode/pal/SimpleHeap/SimpleHeap.cpp
+++ /dev/null
@@ -1,298 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) Microsoft Corporation. All rights reserved.
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-
-#if defined(_DEBUG)
-//#define SIMPLEHEAP_VERBOSE 1
-#define SIMPLEHEAD_DEBUG
-#endif
-
-//#define SIMPLEHEAD_DEBUG
-//#define SIMPLEHEAP_VERBOSE 1
-
-#define SIMPLE_HEAP_GUARDWORD 1
-
-struct BlockHeader
-{
- struct BlockHeader* next;
- struct BlockHeader* prev;
- UINT32 length;
- UINT32 signature;
-#if defined(SIMPLE_HEAP_GUARDWORD)
- UINT32 head_guard;
-#endif
-};
-
-static const UINT32 c_Free = 0xDEADBEEF;
-static const UINT32 c_Busy = 0xDEADBE5E;
-#if defined(SIMPLE_HEAP_GUARDWORD)
-static const UINT32 c_Guard = 0xbab1f00d;
-#endif
-
-#if defined(SIMPLEHEAP_VERBOSE)
-#if defined(PATCH_BUILD)
-const UINT32 g_heapmem_used = 0;
-#else
-UINT32 g_heapmem_used = 0;
-#endif // defined(PATCH_BUILD)
-#endif
-
-#if defined(PATCH_BUILD)
-static struct BlockHeader * const g_s_FirstCluster = NULL;
-#else
-static struct BlockHeader *g_s_FirstCluster;
-#endif // defined(PATCH_BUILD)
-
-//--//
-
-void SimpleHeap_Initialize( void* buffer, UINT32 length )
-{
- struct BlockHeader **s_FirstCluster = (struct BlockHeader **) &g_s_FirstCluster;
-
- *s_FirstCluster = (struct BlockHeader *) buffer;
-
- (*s_FirstCluster)->length = length;
- (*s_FirstCluster)->next = NULL;
- (*s_FirstCluster)->prev = NULL;
- (*s_FirstCluster)->signature = c_Free;
-#if defined(SIMPLE_HEAP_GUARDWORD)
- (*s_FirstCluster)->head_guard = c_Guard;
-#endif
-}
-
-//--//
-
-BOOL SimpleHeap_IsAllocated( void *ptr )
-{
- if(ptr)
- {
- struct BlockHeader* blk = (struct BlockHeader*)ptr; blk--;
-
- if(blk->signature == c_Busy)
- {
- return TRUE;
- }
- else if(blk->signature == c_Free)
- {
- return FALSE;
- }
- else
- {
- // corrupt pointer to memory
- hal_printf( "SimpleHeap: Bad Ptr: 0x%08x\r\n", (size_t)ptr );
- ASSERT(0);
- return FALSE;
- }
- }
-
- return FALSE;
-}
-
-//--//
-
-void SimpleHeap_Release( void* ptr )
-{
-#if defined(SIMPLEHEAP_VERBOSE)
- UINT32 *p_heapmem_used = (UINT32 *) &g_heapmem_used;
-#endif // defined(SIMPLEHEAP_VERBOSE)
-
-#if defined(SIMPLEHEAP_VERBOSE)
- //printf("SimpleHeap_Release(0x%08x)\r\n", (UINT32) ptr);
-#endif
-
- if(ptr)
- {
- struct BlockHeader* next;
- struct BlockHeader* prev;
- struct BlockHeader* blk = (struct BlockHeader*)ptr; blk--;
-
-#if defined(SIMPLEHEAD_DEBUG)
- if(blk->signature != c_Busy)
- {
- if(blk->signature != c_Free)
- {
- hal_printf( " Memory(%08x): CORRUPTION: %08x %08x\r\n", (UINT32) ptr, blk->signature, blk->length );
- }
- else
- {
- hal_printf( " Memory(%08x): RELEASE TWICE: %08x\r\n", (UINT32) ptr, blk->length );
- }
- HARD_BREAKPOINT();
- }
-#endif
-
-#if defined(SIMPLE_HEAP_GUARDWORD)
- if(blk->head_guard != c_Guard)
- {
- hal_printf( "SimpleHeap_Release: Memory block head corruption: %08x %08x\r\n", blk->head_guard, blk->length );
- HARD_BREAKPOINT();
- }
-
- if(*(UINT32*)((UINT32)&blk[0] + blk->length - sizeof( c_Guard )) != c_Guard)
- {
- hal_printf( "SimpleHeap_Release: Memory block tail corruption: %08x %08x\r\n", *(UINT32 *)((UINT32)&blk[0] + blk->length - sizeof( c_Guard )), blk->length );
- HARD_BREAKPOINT();
- }
-#endif
-
- //--//
-
- blk->signature = c_Free;
-
-#if defined(SIMPLEHEAP_VERBOSE)
- *p_heapmem_used -= blk->length;
-
- hal_printf("F:%4d:%08x T:%6d\r\n", blk->length, (UINT32) ptr, *p_heapmem_used);
-#endif
- //
- // First merge with the following block, if free.
- //
- next = blk->next;
- if(next && next->signature == c_Free)
- {
- struct BlockHeader* nextnext;
-
- blk->length += next->length;
-
- nextnext = next->next;
-
- blk->next = nextnext;
-
- if(nextnext) nextnext->prev = blk;
- }
-
- //
- // Then merge with the preceding block, if free.
- //
- prev = blk->prev;
- if(prev && prev->signature == c_Free)
- {
- prev->length += blk->length;
-
- next = blk->next;
-
- prev->next = next;
-
- if(next) next->prev = prev;
- }
- }
- else
- {
- // releasing a null pointer is OK
- //ASSERT(0);
- }
-}
-
-//--//
-
-void* SimpleHeap_Allocate( size_t len )
-{
- struct BlockHeader **pptr = (struct BlockHeader **) &g_s_FirstCluster;
- struct BlockHeader *ptr = *pptr;
-#if defined(SIMPLEHEAP_VERBOSE)
- UINT32 *p_heapmem_used = (UINT32 *) &g_heapmem_used;
-#endif // defined(SIMPLEHEAP_VERBOSE)
-
-#if defined(SIMPLEHEAP_VERBOSE)
- //printf("SimpleHeap_Allocate(%d)\r\n", len);
-
- //Events_WaitForEventsInternal(0, 30); // delay 30mSec to simulate a long GC/compact allocation
-#endif
-
- len += sizeof( struct BlockHeader );
-#if defined(SIMPLE_HEAP_GUARDWORD)
- len += sizeof( c_Guard ); // leave room for tail guard
-#endif
- len = (len + sizeof(UINT32) - 1) & ~(sizeof(UINT32)-1);
-
- while(ptr)
- {
- if(ptr->signature == c_Free && ptr->length >= len)
- {
- if(ptr->length <= (len + sizeof(struct BlockHeader)*2))
- {
- //
- // Perfect or almost perfect fit, nothing else to do.
- //
-
- // note that ptr->length is set to block size, not allocated size,
- // which then gets lost, so we can only check tail guard
- // based on actual size, not requested size, blah...
- break;
- }
- else
- {
- //
- // Split the block in two.
- //
- struct BlockHeader* prev;
- struct BlockHeader* next;
-
- prev = ptr;
- ptr = (struct BlockHeader*)((UINT8*)ptr + ptr->length - len);
- next = prev->next;
-
- ptr->next = next;
- ptr->prev = prev;
-
- prev->next = ptr;
- if(next) next->prev = ptr;
-
- ptr ->length = (int)len;
- prev->length -= (int)len;
- break;
- }
- }
-
- ptr = ptr->next;
- }
-
- if(ptr)
- {
- ptr->signature = c_Busy;
-#if defined(SIMPLE_HEAP_GUARDWORD)
- ptr->head_guard = c_Guard; // set the head guard word
- *(UINT32 *)((UINT32)&ptr[0] + ptr->length - sizeof( c_Guard )) = c_Guard; // set the tail guard word
-#endif
-
-#if defined(SIMPLEHEAP_VERBOSE)
- *p_heapmem_used += ptr->length;
-
- hal_printf("A:%4d:%08x T:%6d\r\n", len, (UINT32) &ptr[1], *p_heapmem_used);
-#endif
- return &ptr[1];
- }
- else
- {
- hal_printf( " Memory: OUTOFMEMORY!! %d\r\n", len );
-
-#if defined(SIMPLEHEAP_VERBOSE)
- hal_printf("SimpleHeap_Allocate(%d)=0x%08x\r\n", len, NULL);
-#endif
-
- return NULL;
- }
-}
-
-//--//
-
-void* SimpleHeap_ReAllocate( void* ptr, size_t len )
-{
- void* p = SimpleHeap_Allocate( len ); if(!p) return NULL;
-
- if(ptr)
- {
- struct BlockHeader* blk = (struct BlockHeader*)ptr; blk--;
-
- memcpy( p, ptr, len > blk->length ? blk->length : len );
-
- SimpleHeap_Release( ptr );
-
- ptr = p;
- }
-
- return p;
-}
-
diff --git a/DeviceCode/pal/SimpleHeap/dotNetMF.proj b/DeviceCode/pal/SimpleHeap/dotNetMF.proj
deleted file mode 100644
index b3a995865..000000000
--- a/DeviceCode/pal/SimpleHeap/dotNetMF.proj
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
- SimpleHeap
-
-
- {F10DFBFE-17D7-4BB5-A53E-8FB8BE11B3EF}
- SimpleHeap unmanaged heap
- PAL
- SimpleHeap.$(LIB_EXT)
- $(SPOCLIENT)\DeviceCode\PAL\SimpleHeap\dotNetMF.proj
- SimpleHeap.$(LIB_EXT).manifest
- System
-
-
-
- 4
- 0
- 0
- 0
-
- 2009-04-30
-
-
-
-
-
- False
- False
-
- False
- False
- DeviceCode\pal\SimpleHeap
- Library
- false
- 4.0.0.0
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DeviceCode/pal/SimpleHeap/stubs/SimpleHeap_stubs.cpp b/DeviceCode/pal/SimpleHeap/stubs/SimpleHeap_stubs.cpp
deleted file mode 100644
index 05c40f48c..000000000
--- a/DeviceCode/pal/SimpleHeap/stubs/SimpleHeap_stubs.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) Microsoft Corporation. All rights reserved.
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#include "tinyhal.h"
-
-//--//
-
-void SimpleHeap_Initialize( void* buffer, UINT32 length )
-{
-}
-
-void* SimpleHeap_Allocate( size_t len )
-{
- return NULL;
-}
-
-void SimpleHeap_Release( void* ptr )
-{
-}
-
-void* SimpleHeap_ReAllocate( void* ptr, size_t len )
-{
- return NULL;
-}
diff --git a/DeviceCode/pal/SimpleHeap/stubs/dotNetMF.proj b/DeviceCode/pal/SimpleHeap/stubs/dotNetMF.proj
deleted file mode 100644
index 03a14eea4..000000000
--- a/DeviceCode/pal/SimpleHeap/stubs/dotNetMF.proj
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
- SimpleHeap_stubs
-
-
- {CFD0FC57-C506-461D-B460-9D44C8A6A6B6}
- SimpleHeap unmanaged heap stub library
- PAL
- SimpleHeap_stubs.$(LIB_EXT)
- $(SPOCLIENT)\DeviceCode\PAL\SimpleHeap\stubs\dotNetMF.proj
- SimpleHeap_stubs.$(LIB_EXT).manifest
- System
-
-
-
- 4
- 0
- 0
- 0
-
- 2009-04-30
-
-
-
-
-
- False
- False
- False
- True
- DeviceCode\pal\SimpleHeap\stubs
- Library
- false
- 4.0.0.0
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DeviceCode/pal/SimpleHeap_config/SimpleHeap_config.cpp b/DeviceCode/pal/SimpleHeap_config/SimpleHeap_config.cpp
deleted file mode 100644
index 2cab5dd36..000000000
--- a/DeviceCode/pal/SimpleHeap_config/SimpleHeap_config.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) Microsoft Corporation. All rights reserved.
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-
-/**********************************************************************
-**
-** Function: CustomHeapLocation retrives the buffer to be used for Simple Heap allocations
-** PK customers need to implement this function if they want to use it with Simple Heap.
-** This function returns the buffer location and the size of the buffer.
-** inline void HAL_Init_Custom_Heap() ( in tynihal.h )calls CustomHeapLocation to retrive
-** custom heap location and initialize custom heap.
-**
-** Arguments: [BaseAddress] - Reference to pointer to buffer for custom heap. Filled by function
-** [SizeInBytes] - Reference to varialbe that receives size of the buffer.
-**********************************************************************/
-void CustomHeapLocation( UINT8*& BaseAddress, UINT32& SizeInBytes )
-
-{
- NATIVE_PROFILE_PAL_HEAP();
-#if defined (PLATFORM_ARM)
-
- BaseAddress = (UINT8*) &CustomHeapBegin;
- SizeInBytes = (UINT32)((size_t)&CustomHeapEnd - (size_t)&CustomHeapBegin + sizeof(CustomHeapEnd));
-
-#elif defined(PLATFORM_BLACKFIN)
-
- BaseAddress = 0;
- SizeInBytes = 0;
-
-#elif defined(PLATFORM_SH)
-
- BaseAddress = 0;
- SizeInBytes = 0;
-
-
-#endif
-}
-
diff --git a/DeviceCode/pal/SimpleHeap_config/Stubs/SimpleHeap_config_stubs.cpp b/DeviceCode/pal/SimpleHeap_config/Stubs/SimpleHeap_config_stubs.cpp
deleted file mode 100644
index 93d38b1c3..000000000
--- a/DeviceCode/pal/SimpleHeap_config/Stubs/SimpleHeap_config_stubs.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) Microsoft Corporation. All rights reserved.
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#include "tinyhal.h"
-
-//--//
-
-void CustomHeapLocation( UINT8*& BaseAddress, UINT32& SizeInBytes )
-
-{
- NATIVE_PROFILE_PAL_HEAP();
- BaseAddress = 0;
- SizeInBytes = 0;
-}
-
diff --git a/DeviceCode/pal/SimpleHeap_config/Stubs/dotNetMF.proj b/DeviceCode/pal/SimpleHeap_config/Stubs/dotNetMF.proj
deleted file mode 100644
index c64944a3f..000000000
--- a/DeviceCode/pal/SimpleHeap_config/Stubs/dotNetMF.proj
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
- SimpleHeap_config_stubs
-
-
- {C2E23FAE-3112-4376-9D4B-08BB9523FA69}
- SimpleHeap configuration stub library
- PAL
- SimpleHeap_config_stubs.$(LIB_EXT)
- $(SPOCLIENT)\DeviceCode\PAL\SimpleHeap_config\Stubs\dotNetMF.proj
- SimpleHeap_config_stubs.$(LIB_EXT).manifest
- System
-
-
-
- 4
- 0
- 0
- 0
-
- 2009-04-30
-
-
-
-
-
- False
- False
- False
- True
- DeviceCode\pal\SimpleHeap_config\Stubs
- Library
- false
- 4.0.0.0
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DeviceCode/pal/SimpleHeap_config/dotNetMF.proj b/DeviceCode/pal/SimpleHeap_config/dotNetMF.proj
deleted file mode 100644
index ab0eeb140..000000000
--- a/DeviceCode/pal/SimpleHeap_config/dotNetMF.proj
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
- SimpleHeap_config
-
-
- {742F3095-DC26-4F8E-8689-74900D30602E}
- Simple unmanaged heap
- PAL
- SimpleHeap_config.$(LIB_EXT)
- $(SPOCLIENT)\DeviceCode\PAL\SimpleHeap_config\dotNetMF.proj
- SimpleHeap_config.$(LIB_EXT).manifest
- System
-
-
-
- 4
- 0
- 0
- 0
-
- 2009-04-30
-
-
-
-
-
- False
- False
- False
- False
- DeviceCode\pal\SimpleHeap_config
- Library
- false
- 4.0.0.0
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DeviceCode/pal/configuration/ConfigHelper.cpp b/DeviceCode/pal/configuration/ConfigHelper.cpp
index 3bf81f25e..77eb1b23c 100644
--- a/DeviceCode/pal/configuration/ConfigHelper.cpp
+++ b/DeviceCode/pal/configuration/ConfigHelper.cpp
@@ -193,7 +193,7 @@ BOOL HAL_CONFIG_BLOCK::CompactBlock(HAL_CONFIG_BLOCK_STORAGE_DATA& blData, const
int saveLength = (UINT32)cfgEnd - blData.ConfigAddress;
//
- UINT8 *pBackup = (UINT8*)private_malloc( saveLength );
+ UINT8 *pBackup = (UINT8*)malloc( saveLength );
if(pBackup)
{
@@ -228,7 +228,7 @@ BOOL HAL_CONFIG_BLOCK::CompactBlock(HAL_CONFIG_BLOCK_STORAGE_DATA& blData, const
fRet = blData.Device->Write((UINT32)blData.ConfigAddress, writeLength, pBackup, FALSE);
// if the heap is not yet initialized this does nothing
- private_free( pBackup );
+ free( pBackup );
}
return fRet;
@@ -305,7 +305,7 @@ BOOL HAL_CONFIG_BLOCK::UpdateBlockWithName( const char* Name, void* Data, size_t
}
else
{
- pXipConfigBuf = (BYTE*)private_malloc(blData.BlockLength);
+ pXipConfigBuf = (BYTE*)malloc(blData.BlockLength);
if(pXipConfigBuf != NULL)
{
@@ -349,7 +349,7 @@ BOOL HAL_CONFIG_BLOCK::UpdateBlockWithName( const char* Name, void* Data, size_t
physAddr = (const void*)(blData.ConfigAddress + ((size_t)pConfig - (size_t)pXipConfigBuf));
physEnd = (const void*)(blData.ConfigAddress + ((size_t)pLastConfig - (size_t)pXipConfigBuf));
- private_free(pXipConfigBuf);
+ free(pXipConfigBuf);
pXipConfigBuf = NULL;
}
@@ -395,7 +395,7 @@ BOOL HAL_CONFIG_BLOCK::UpdateBlockWithName( const char* Name, void* Data, size_t
if(pXipConfigBuf != NULL)
{
- private_free(pXipConfigBuf);
+ free(pXipConfigBuf);
}
return fRet;
@@ -428,7 +428,7 @@ BOOL HAL_CONFIG_BLOCK::ApplyConfig( const char* Name, void* Address, size_t Leng
}
else
{
- pXipConfigBuf = (BYTE*)private_malloc(blData.BlockLength);
+ pXipConfigBuf = (BYTE*)malloc(blData.BlockLength);
if(pXipConfigBuf != NULL)
@@ -448,7 +448,7 @@ BOOL HAL_CONFIG_BLOCK::ApplyConfig( const char* Name, void* Address, size_t Leng
{
if(newAlloc != NULL)
{
- *newAlloc = private_malloc(header->Size);
+ *newAlloc = malloc(header->Size);
if(*newAlloc)
{
@@ -470,7 +470,7 @@ BOOL HAL_CONFIG_BLOCK::ApplyConfig( const char* Name, void* Address, size_t Leng
if(pXipConfigBuf != NULL)
{
- private_free(pXipConfigBuf);
+ free(pXipConfigBuf);
}
return FALSE;
diff --git a/DeviceCode/pal/dotNetMF.proj b/DeviceCode/pal/dotNetMF.proj
index 7bbee8a98..7e4b7109a 100644
--- a/DeviceCode/pal/dotNetMF.proj
+++ b/DeviceCode/pal/dotNetMF.proj
@@ -31,10 +31,6 @@
-
-
-
-
diff --git a/DeviceCode/pal/fs/fs_pal.cpp b/DeviceCode/pal/fs/fs_pal.cpp
index df7b6a79a..0b7a9e3b7 100644
--- a/DeviceCode/pal/fs/fs_pal.cpp
+++ b/DeviceCode/pal/fs/fs_pal.cpp
@@ -118,7 +118,7 @@ void FS_MountVolume( LPCSTR nameSpace, UINT32 serialNumber, UINT32 deviceFlags,
{
current->Unlink();
- private_free( current );
+ free( current );
}
current = next;
@@ -146,7 +146,7 @@ void FS_MountVolume( LPCSTR nameSpace, UINT32 serialNumber, UINT32 deviceFlags,
for (i = 0; i < numVolumes; i++)
{
// Allocate the memory for this FileSystemVolume
- volume = (FileSystemVolume*)private_malloc( sizeof(FileSystemVolume) );
+ volume = (FileSystemVolume*)malloc( sizeof(FileSystemVolume) );
if(!volume) // allocation failed
{
@@ -160,7 +160,7 @@ void FS_MountVolume( LPCSTR nameSpace, UINT32 serialNumber, UINT32 deviceFlags,
streamDriver, fsDriver, blockStorageDevice, i, (fsDriver) ? TRUE : FALSE )) // init only when we have a valid fsDriver
{
// If for some reason, AddVolume fails, we'll keep trying other volumes
- private_free( volume );
+ free( volume );
continue;
}
diff --git a/DeviceCode/pal/piezo/Piezo.cpp b/DeviceCode/pal/piezo/Piezo.cpp
index 90213d1d9..245f5fbf9 100644
--- a/DeviceCode/pal/piezo/Piezo.cpp
+++ b/DeviceCode/pal/piezo/Piezo.cpp
@@ -153,7 +153,7 @@ BOOL Piezo_Driver::Tone( UINT32 Frequency_Hertz, UINT32 Duration_Milliseconds )
//
irq.Release();
- Tone = (PIEZO_TONE*)private_malloc( sizeof(PIEZO_TONE) );
+ Tone = (PIEZO_TONE*)malloc( sizeof(PIEZO_TONE) );
Tone->Initialize();
@@ -254,7 +254,7 @@ void Piezo_Driver::ToneRelease( void* Param )
//
irq.Release();
- private_free( Tone );
+ free( Tone );
irq.Acquire();
}
@@ -338,7 +338,7 @@ BOOL PolyphonicPiezo_Driver::Tone( const PIEZO_POLY_TONE& ToneRef )
//
irq.Release();
- Tone = (PIEZO_POLY_TONE*)private_malloc( sizeof(PIEZO_POLY_TONE) );
+ Tone = (PIEZO_POLY_TONE*)malloc( sizeof(PIEZO_POLY_TONE) );
irq.Acquire();
}
@@ -440,7 +440,7 @@ void PolyphonicPiezo_Driver::ToneRelease( void* Param )
//
irq.Release();
- private_free( Tone );
+ free( Tone );
irq.Acquire();
}
diff --git a/Framework/Features/Graphics.featureproj b/Framework/Features/Graphics.featureproj
index 49e4c3bf2..ed4c78ef8 100644
--- a/Framework/Features/Graphics.featureproj
+++ b/Framework/Features/Graphics.featureproj
@@ -14,7 +14,6 @@
-
Core graphics functionality
{af24014a-d92b-44dd-a6d0-d46d14d553cc}
diff --git a/ProjectTemplates/NativeSample/NativeSample.cpp b/ProjectTemplates/NativeSample/NativeSample.cpp
index ae8d13f4c..c7d2b7b47 100644
--- a/ProjectTemplates/NativeSample/NativeSample.cpp
+++ b/ProjectTemplates/NativeSample/NativeSample.cpp
@@ -7,9 +7,6 @@
#include
#include "nativesample.h"
-
-HAL_DECLARE_NULL_HEAP();
-
void PostManagedEvent( UINT8 category, UINT8 subCategory, UINT16 data1, UINT32 data2 )
{
}
diff --git a/ProjectTemplates/PortBooter/portBooter.cpp b/ProjectTemplates/PortBooter/portBooter.cpp
index 49129c1e6..0fca2d883 100644
--- a/ProjectTemplates/PortBooter/portBooter.cpp
+++ b/ProjectTemplates/PortBooter/portBooter.cpp
@@ -710,8 +710,6 @@ XREC_Handler g_XREC;
//--//
-HAL_DECLARE_NULL_HEAP();
-
void ApplicationEntryPoint()
{
UINT32 ComEvent;
diff --git a/ProjectTemplates/PortBooter/portBooterLoader.cpp b/ProjectTemplates/PortBooter/portBooterLoader.cpp
index ffd2a1482..f80d71f93 100644
--- a/ProjectTemplates/PortBooter/portBooterLoader.cpp
+++ b/ProjectTemplates/PortBooter/portBooterLoader.cpp
@@ -13,8 +13,6 @@ typedef unsigned char UINT8;
int LZ77_Decompress( UINT8* inBuf, int inSize, UINT8* outBuf, int outSize );
-HAL_DECLARE_NULL_HEAP();
-
extern "C"
{
void BootEntryLoader()
diff --git a/Solutions/MCBSTM32F400/DeviceCode/Initialization/tinyhal.cpp b/Solutions/MCBSTM32F400/DeviceCode/Initialization/tinyhal.cpp
index a81e9ebdf..97e1e1e27 100644
--- a/Solutions/MCBSTM32F400/DeviceCode/Initialization/tinyhal.cpp
+++ b/Solutions/MCBSTM32F400/DeviceCode/Initialization/tinyhal.cpp
@@ -24,44 +24,6 @@
#undef DEBUG_TRACE
#define DEBUG_TRACE (TRACE_ALWAYS)
-// these define the region to zero initialize
-extern UINT32 Image$$ER_RAM_RW$$ZI$$Base;
-extern UINT32 Image$$ER_RAM_RW$$ZI$$Length;
-
-// here is the execution address/length of code to move from FLASH to RAM
-#define IMAGE_RAM_RO_BASE Image$$ER_RAM_RO$$Base
-#define IMAGE_RAM_RO_LENGTH Image$$ER_RAM_RO$$Length
-
-extern UINT32 IMAGE_RAM_RO_BASE;
-extern UINT32 IMAGE_RAM_RO_LENGTH;
-
-// here is the execution address/length of data to move from FLASH to RAM
-extern UINT32 Image$$ER_RAM_RW$$Base;
-extern UINT32 Image$$ER_RAM_RW$$Length;
-
-// here is the load address of the RAM code/data
-#define LOAD_RAM_RO_BASE Load$$ER_RAM_RO$$Base
-
-extern UINT32 LOAD_RAM_RO_BASE;
-extern UINT32 Load$$ER_RAM_RW$$Base;
-
-#if defined(TARGETLOCATION_RAM)
-
-extern UINT32 Load$$ER_RAM$$Base;
-extern UINT32 Image$$ER_RAM$$Length;
-
-#elif defined(TARGETLOCATION_FLASH)
-
-extern UINT32 Load$$ER_FLASH$$Base;
-extern UINT32 Image$$ER_FLASH$$Length;
-
-#else
- !ERROR
-#endif
-
-UINT32 LOAD_IMAGE_Start;
-UINT32 LOAD_IMAGE_Length;
-UINT32 LOAD_IMAGE_CalcCRC;
#if defined(PLATFORM_ARM_OS_PORT) && defined(TCPIP_LWIP_OS)
extern UINT32 Load$$ER_LWIP_OS$$RW$$Base;
@@ -124,64 +86,10 @@ static void __section("SectionForBootstrapOperations") Prepare_Zero( UINT32* dst
}
}
-#if !defined(PLATFORM_ARM_OS_PORT) || defined(__GNUC__)
-void __section("SectionForBootstrapOperations") PrepareImageRegions()
-{
- //
- // Copy RAM RO regions into proper location.
- //
- {
- UINT32* src = (UINT32*)&LOAD_RAM_RO_BASE;
- UINT32* dst = (UINT32*)&IMAGE_RAM_RO_BASE;
- UINT32 len = (UINT32 )&IMAGE_RAM_RO_LENGTH;
-
- Prepare_Copy( src, dst, len );
- }
-
- //
- // Copy RAM RW regions into proper location.
- //
- {
- UINT32* src = (UINT32*)&Load$$ER_RAM_RW$$Base;
- UINT32* dst = (UINT32*)&Image$$ER_RAM_RW$$Base;
- UINT32 len = (UINT32)&Image$$ER_RAM_RW$$Length;
-
- Prepare_Copy( src, dst, len );
- }
-
- //
- // Initialize RAM ZI regions.
- //
- {
- UINT32* dst = (UINT32*)&Image$$ER_RAM_RW$$ZI$$Base;
- UINT32 len = (UINT32 )&Image$$ER_RAM_RW$$ZI$$Length;
-
- Prepare_Zero( dst, len );
- }
-}
-#else
-extern "C" void PrepareImageRegions()
-{
- // This space intentionally left blank... 8^)
- //
- // The OS boot of CLR on CMSIS-RTX doesn't
- // use this as it relies on the C/C++ runtime
- // to handle initialization. However, to keep
- // from adding more libraries or #if checks
- // in code this is defined to allow normal
- // linking with the same HAL libs used in a
- // boot loader.
-}
-#endif
-
#pragma arm section code
//--//
-#if !defined(BUILD_RTM)
-static UINT32 g_Boot_RAMConstants_CRC = 0;
-#endif
-
static ON_SOFT_REBOOT_HANDLER s_rebootHandlers[16] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
void HAL_AddSoftRebootHandler(ON_SOFT_REBOOT_HANDLER handler)
@@ -276,7 +184,7 @@ void HAL_EnterBooterMode()
::Watchdog_ResetCounter();
- BYTE *data = (BYTE*) private_malloc(pBlockRegionInfo->BytesPerBlock);
+ BYTE *data = (BYTE*) malloc(pBlockRegionInfo->BytesPerBlock);
if(data != NULL)
{
@@ -305,7 +213,7 @@ void HAL_EnterBooterMode()
// write back to sector, as we only change one bit from 0 to 1, no need to erase sector
bRet = (TRUE == pBlockDevice->Write( configSectAddress, pBlockRegionInfo->BytesPerBlock, data, FALSE ));
- private_free(data);
+ free(data);
}
}
@@ -331,8 +239,6 @@ void HAL_Initialize()
HAL_CONTINUATION::InitializeList();
HAL_COMPLETION ::InitializeList();
- HAL_Init_Custom_Heap();
-
Time_Initialize();
Events_Initialize();
@@ -512,61 +418,10 @@ void HAL_Uninitialize()
extern "C"
{
-#if defined( __GNUC__ )
- extern "C++" int main(void);
- extern void __libc_init_array();
- void __main()
- {
- // Copy writeable data and zero init BSS
- PrepareImageRegions();
-
- // Call static constructors
- __libc_init_array();
-
- // Call the application's entry point.
- main();
- }
-#endif
#if !defined(PLATFORM_ARM_OS_PORT)
void BootEntry()
{
-#if !defined(BUILD_RTM)
- {
- int marker;
- int* ptr = &marker - 1; // This will point to the current top of the stack.
- int* end = &StackBottom;
-
- while(ptr >= end)
- {
- *ptr-- = 0xBAADF00D;
- }
- }
-#endif
-
- // these are needed for patch access
-
-#if defined(TARGETLOCATION_RAM)
-
- LOAD_IMAGE_Start = (UINT32)&Load$$ER_RAM$$Base;
- LOAD_IMAGE_Length = (UINT32)&Image$$ER_RAM$$Length;
-
-#elif defined(TARGETLOCATION_FLASH)
-
- LOAD_IMAGE_Start = (UINT32)&Load$$ER_FLASH$$Base;
- LOAD_IMAGE_Length = (UINT32)&Image$$ER_FLASH$$Length;
-
-#else
- !ERROR
-#endif
-
- LOAD_IMAGE_Length += (UINT32)&IMAGE_RAM_RO_LENGTH + (UINT32)&Image$$ER_RAM_RW$$Length;
-
-#if !defined(BUILD_RTM)
- g_Boot_RAMConstants_CRC = Checksum_RAMConstants();
-#endif
-
-
CPU_Initialize();
HAL_Time_Initialize();
@@ -582,12 +437,6 @@ void BootEntry()
DEBUG_TRACE1(TRACE_ALWAYS, "ARM Compiler version %d\r\n", __ARMCC_VERSION);
#endif
- UINT8* BaseAddress;
- UINT32 SizeInBytes;
-
- HeapLocation( BaseAddress, SizeInBytes );
- memset ( BaseAddress, 0, SizeInBytes );
-
debug_printf("\f");
debug_printf("%-15s\r\n", HalName);
@@ -629,7 +478,7 @@ void BootEntry()
#if defined(PLATFORM_ARM_OS_PORT)
-extern "C" void STM32F4_BootstrapCode();
+extern "C" void BootstrapCode();
// performs base level system initialization
// This typically consists of setting up clocks
@@ -647,7 +496,7 @@ extern "C" void STM32F4_BootstrapCode();
// as the kernel isn't initialized yet either.
extern "C" void SystemInit()
{
- STM32F4_BootstrapCode();
+ BootstrapCode();
CPU_Initialize();
__enable_irq();
}
@@ -685,76 +534,3 @@ void lcd_printf( const char* format, ... )
}
#endif // !defined(BUILD_RTM)
-
-#if !defined(BUILD_RTM)
-
-UINT32 Checksum_RAMConstants()
-{
- UINT32* RAMConstants = (UINT32*)&IMAGE_RAM_RO_BASE;
- UINT32 Length = (UINT32 )&IMAGE_RAM_RO_LENGTH;
-
- UINT32 crc;
-
- // start with Vector area CRC
- crc = SUPPORT_ComputeCRC(NULL, 0x00000020, 0);
-
- // add the big block of RAM constants to CRC
- crc = SUPPORT_ComputeCRC(RAMConstants, Length, crc);
-
- return crc;
-}
-
-void Verify_RAMConstants( void* arg )
-{
- BOOL BreakpointOnError = (BOOL)arg;
-
- //debug_printf("RAMC\r\n");
-
- UINT32 crc = Checksum_RAMConstants();
-
- if (crc != g_Boot_RAMConstants_CRC)
- {
- hal_printf("RAMC CRC:%08x!=%08x\r\n", crc, g_Boot_RAMConstants_CRC);
-
- UINT32* ROMConstants = (UINT32*)&LOAD_RAM_RO_BASE;
- UINT32* RAMConstants = (UINT32*)&IMAGE_RAM_RO_BASE;
- UINT32 Length = (UINT32 )&IMAGE_RAM_RO_LENGTH;
- BOOL FoundMismatch = FALSE;
-
- for(int i = 0; i < Length; i += 4)
- {
- if(*RAMConstants != *ROMConstants)
- {
- hal_printf( "RAMC %08x:%08x!=%08x\r\n", (UINT32) RAMConstants, *RAMConstants, *ROMConstants );
-
- if(!FoundMismatch) lcd_printf( "\fRAMC:%08x\r\n", (UINT32)RAMConstants ); // first one only to LCD
- FoundMismatch = TRUE;
- }
-
- RAMConstants++;
- ROMConstants++;
- }
-
- if(!FoundMismatch)
- {
- // the vector area must have been trashed
- lcd_printf("\fRAMC:%08x\r\n", (UINT32) NULL);
- RAMConstants = (UINT32*)NULL;
-
- for(int i = 0; i < 32; i += 4)
- {
- hal_printf( "RAMC %02x:%08x\r\n", i, *RAMConstants );
- lcd_printf( "%02x:%08x\r\n" , i, *RAMConstants++ );
- }
- }
-
- DebuggerPort_Flush( HalSystemConfig.DebugTextPort );
-
- if(BreakpointOnError)
- {
- HARD_BREAKPOINT();
- }
- }
-}
-
-#endif // !defined(BUILD_RTM)
diff --git a/Solutions/MCBSTM32F400/DeviceCode/TinyHal/GNU_S/AppEntry.s b/Solutions/MCBSTM32F400/DeviceCode/TinyHal/GNU_S/AppEntry.s
index 9fe126a4a..fb3ec1e85 100644
--- a/Solutions/MCBSTM32F400/DeviceCode/TinyHal/GNU_S/AppEntry.s
+++ b/Solutions/MCBSTM32F400/DeviceCode/TinyHal/GNU_S/AppEntry.s
@@ -24,44 +24,32 @@
.global EntryPoint
- .global StackBottom
- .global StackTop
.global HeapBegin
.global HeapEnd
- .global CustomHeapBegin
- .global CustomHeapEnd
- .global __initial_sp
+ .global _stack
.global Reset_Handler
.extern SystemInit
- .extern __main
@*************************************************************************
- .section SectionForStackBottom, "w", %nobits
-StackBottom:
- .word 0
-
- .section SectionForStackTop, "w", %nobits
-__initial_sp:
-StackTop:
- .word 0
-
- .section SectionForHeapBegin, "w", %nobits
-HeapBegin:
- .word 0
-
- .section SectionForHeapEnd, "w", %nobits
-HeapEnd:
- .word 0
-
- .section SectionForCustomHeapBegin, "w", %nobits
-CustomHeapBegin:
- .word 0
-
- .section SectionForCustomHeapEnd, "w", %nobits
-CustomHeapEnd:
- .word 0
+ /* start address for the initialization values of the .data section.
+ defined in linker script */
+ .word _sidata
+ /* start address for the .data section. defined in linker script */
+ .word _sdata
+ /* end address for the .data section. defined in linker script */
+ .word _edata
+ /* start address for the .bss section. defined in linker script */
+ .word _sbss
+ /* end address for the .bss section. defined in linker script */
+ .word _ebss
+ /* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+ /* start address of managed heap */
+ .word HeapBegin
+ /* end address of managed heap */
+ .word HeapEnd
.section i.EntryPoint, "ax", %progbits
EntryPoint:
@@ -96,12 +84,45 @@ EntryPoint:
Reset_Handler:
@@ reload the stack pointer as there's no returning to the loader
- ldr sp, =__initial_sp
- LDR R0, =SystemInit
- BLX R0
- LDR R0, =__main
- BX R0
-
+ ldr sp, =_estack /* set stack pointer */
+
+ /* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+ /* Call the clock system intitialization function.*/
+ bl SystemInit
+
+ /* Call static constructors */
+ bl __libc_init_array
+
+ /* Call the application's entry point.*/
+ bl main
+ bx lr
.pool
.size Reset_Handler, . - Reset_Handler
diff --git a/Solutions/MCBSTM32F400/DeviceCode/TinyHal/GNU_S/FirstEntry.s b/Solutions/MCBSTM32F400/DeviceCode/TinyHal/GNU_S/FirstEntry.s
index d181e5576..6d660149e 100644
--- a/Solutions/MCBSTM32F400/DeviceCode/TinyHal/GNU_S/FirstEntry.s
+++ b/Solutions/MCBSTM32F400/DeviceCode/TinyHal/GNU_S/FirstEntry.s
@@ -16,47 +16,35 @@
.thumb
.global EntryPoint
- .global __initial_sp
.global Reset_Handler
- .global StackBottom
- .global StackTop
.global HeapBegin
.global HeapEnd
- .global CustomHeapBegin
- .global CustomHeapEnd
+ .global _end
.global PowerOnReset
- .extern PreStackInit
-
.extern BootEntry
.extern BootstrapCode
@*************************************************************************
- .section SectionForStackBottom, "w", %nobits
-StackBottom:
- .word 0
-
- .section SectionForStackTop, "w", %nobits
-__initial_sp:
-StackTop:
- .word 0
-
- .section SectionForHeapBegin, "w", %nobits
-HeapBegin:
- .word 0
-
- .section SectionForHeapEnd, "w", %nobits
-HeapEnd:
- .word 0
-
- .section SectionForCustomHeapBegin, "w", %nobits
-CustomHeapBegin:
- .word 0
-
- .section SectionForCustomHeapEnd, "w", %nobits
-CustomHeapEnd:
- .word 0
+ /* start address for the initialization values of the .data section.
+ defined in linker script */
+ .word _sidata
+ /* start address for the .data section. defined in linker script */
+ .word _sdata
+ /* end address for the .data section. defined in linker script */
+ .word _edata
+ /* start address for the .bss section. defined in linker script */
+ .word _sbss
+ /* end address for the .bss section. defined in linker script */
+ .word _ebss
+ /* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+ /* start address of managed heap */
+ .word HeapBegin
+ /* end address of managed heap */
+ .word HeapEnd
+
@ Power On Reset vector table for the device
@ This is placed at physical address 0 by the
@@ -68,7 +56,7 @@ CustomHeapEnd:
.section SectionForPowerOnReset, "x", %progbits
PowerOnReset:
- .word __initial_sp
+ .word _estack
.word Reset_Handler @ Reset
.word Fault_Handler @ NMI
.word Fault_Handler @ Hard Fault
@@ -86,11 +74,47 @@ PowerOnReset:
.section i.EntryPoint, "ax", %progbits
EntryPoint:
Reset_Handler:
- bl BootstrapCode
- b BootEntry
+ ldr sp, =_estack /* set stack pointer */
+
+ /* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+ /* Call the clock system intitialization function.*/
+ bl SystemInit
+ /* Call static constructors */
+ bl __libc_init_array
+ /* Call the application's entry point.*/
+
+ bl main
+ bx lr
.pool
- .size Reset_Handler, . - Reset_Handler
+ .size Reset_Handler, .-Reset_Handler
.balign 4
diff --git a/Solutions/MCBSTM32F400/MCBSTM32F400.settings b/Solutions/MCBSTM32F400/MCBSTM32F400.settings
index 19746763e..4283412de 100644
--- a/Solutions/MCBSTM32F400/MCBSTM32F400.settings
+++ b/Solutions/MCBSTM32F400/MCBSTM32F400.settings
@@ -14,6 +14,7 @@
le
true
LWIP_1_4_1_OS
+ true
Copyright (C) Microsoft Corporation
diff --git a/Solutions/MCBSTM32F400/MCBSTM32F400_NONET.settings b/Solutions/MCBSTM32F400/MCBSTM32F400_NONET.settings
index c9faee51e..0a94c5049 100644
--- a/Solutions/MCBSTM32F400/MCBSTM32F400_NONET.settings
+++ b/Solutions/MCBSTM32F400/MCBSTM32F400_NONET.settings
@@ -13,6 +13,7 @@
True
le
true
+ true
Copyright (C) Microsoft .NET Foundation
diff --git a/Solutions/MCBSTM32F400/MicroBooter/MicroBooter.proj b/Solutions/MCBSTM32F400/MicroBooter/MicroBooter.proj
index 269feb407..a6db61d8e 100644
--- a/Solutions/MCBSTM32F400/MicroBooter/MicroBooter.proj
+++ b/Solutions/MCBSTM32F400/MicroBooter/MicroBooter.proj
@@ -119,14 +119,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/MCBSTM32F400/TinyBooter/TinyBooter.proj b/Solutions/MCBSTM32F400/TinyBooter/TinyBooter.proj
index d9d1375cf..7ce02a0fb 100644
--- a/Solutions/MCBSTM32F400/TinyBooter/TinyBooter.proj
+++ b/Solutions/MCBSTM32F400/TinyBooter/TinyBooter.proj
@@ -23,6 +23,8 @@
$(ExtraTargets);CompressBin
scatterfile_bootloader_$(COMPILER_TOOL).$(SCATTER_EXT)
scatterfile_bootloader_$(COMPILER_TOOL).$(SCATTER_EXT)
+
+ true
@@ -145,14 +147,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/MCBSTM32F400/TinyBooter/allocator.cpp b/Solutions/MCBSTM32F400/TinyBooter/allocator.cpp
index 59ddd068e..4336cb48d 100644
--- a/Solutions/MCBSTM32F400/TinyBooter/allocator.cpp
+++ b/Solutions/MCBSTM32F400/TinyBooter/allocator.cpp
@@ -41,3 +41,16 @@ void operator delete[] (void*)
}
////////////////////////////////////////////////////////////////////////////////
+
+// the following remapping seems to be required by the crypto libs, as soon as those are reworked this should be removed
+// remap private_malloc to standard C malloc
+void *private_malloc(size_t size)
+{
+ return malloc(size);
+}
+
+// remap private_free to standard C free
+void private_free(void *ptr)
+{
+ free(ptr);
+}
diff --git a/Solutions/MCBSTM32F400/TinyBooter/scatterfile_bootloader_gcc.xml b/Solutions/MCBSTM32F400/TinyBooter/scatterfile_bootloader_gcc.xml
index 1237b057d..64154ce85 100644
--- a/Solutions/MCBSTM32F400/TinyBooter/scatterfile_bootloader_gcc.xml
+++ b/Solutions/MCBSTM32F400/TinyBooter/scatterfile_bootloader_gcc.xml
@@ -70,8 +70,7 @@
-
-
+
@@ -81,7 +80,6 @@
with the SWD pins used for ETM tracing in Debug builds.
-->
-
@@ -106,17 +104,59 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
@@ -139,63 +189,73 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
-
+
-
-
-
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Solutions/MCBSTM32F400/TinyCLR/TinyCLR.proj b/Solutions/MCBSTM32F400/TinyCLR/TinyCLR.proj
index 2869bc261..ae97e0bb4 100644
--- a/Solutions/MCBSTM32F400/TinyCLR/TinyCLR.proj
+++ b/Solutions/MCBSTM32F400/TinyCLR/TinyCLR.proj
@@ -27,6 +27,8 @@
false
$(BIN_DIR)\$(AssemblyName).dat
$(SRC_DIR)\scatterfile_$(AssemblyName)_$(COMPILER_TOOL).$(SCATTER_EXT)
+
+ true
EntryPoint
TinyClr_Dat_Start
g_ConfigurationSector
@@ -210,14 +212,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/MCBSTM32F400/TinyCLR/allocator.cpp b/Solutions/MCBSTM32F400/TinyCLR/allocator.cpp
index 372f95138..03d64fe12 100644
--- a/Solutions/MCBSTM32F400/TinyCLR/allocator.cpp
+++ b/Solutions/MCBSTM32F400/TinyCLR/allocator.cpp
@@ -10,22 +10,35 @@
void *operator new( size_t n )
{
- return private_malloc( n );
+ return malloc( n );
}
void *operator new[]( size_t n )
{
- return private_malloc( n );
+ return malloc( n );
}
void operator delete( void* p )
{
- return private_free( p );
+ return free( p );
}
void operator delete[]( void* p )
{
- return private_free( p );
+ return free( p );
}
////////////////////////////////////////////////////////////////////////////////
+
+// the following remapping seems to be required by the crypto libs, as soon as those are reworked this should be removed
+// remap private_malloc to standard C malloc
+void *private_malloc(size_t size)
+{
+ return malloc(size);
+}
+
+// remap private_free to standard C free
+void private_free(void *ptr)
+{
+ free(ptr);
+}
diff --git a/Solutions/MCBSTM32F400/TinyCLR/scatterfile_tinyclr_gcc.xml b/Solutions/MCBSTM32F400/TinyCLR/scatterfile_tinyclr_gcc.xml
index 4fdb0b8f4..80033a149 100644
--- a/Solutions/MCBSTM32F400/TinyCLR/scatterfile_tinyclr_gcc.xml
+++ b/Solutions/MCBSTM32F400/TinyCLR/scatterfile_tinyclr_gcc.xml
@@ -38,6 +38,7 @@
+
-
@@ -80,7 +80,6 @@
with the SWD pins used for ETM tracing in Debug builds.
-->
-
@@ -107,27 +106,58 @@
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
-
-
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -236,14 +266,25 @@
actual physical CCM space. The CRT startup code will initialize the region and, if the aligned size
puts the end outside of physical memory it will generate an imprecise abort.
-->
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -255,22 +296,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Solutions/MCBSTM32F400/TinyCLR_NONET/TinyCLR_NONET.proj b/Solutions/MCBSTM32F400/TinyCLR_NONET/TinyCLR_NONET.proj
index 868d7a2c6..4cf849daf 100644
--- a/Solutions/MCBSTM32F400/TinyCLR_NONET/TinyCLR_NONET.proj
+++ b/Solutions/MCBSTM32F400/TinyCLR_NONET/TinyCLR_NONET.proj
@@ -27,6 +27,8 @@
false
$(BIN_DIR)\$(AssemblyName).dat
$(SRC_DIR)\scatterfile_$(AssemblyName)_$(COMPILER_TOOL).$(SCATTER_EXT)
+
+ true
EntryPoint
TinyClr_Dat_Start
g_ConfigurationSector
@@ -178,14 +180,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/MCBSTM32F400/TinyCLR_NONET/allocator.cpp b/Solutions/MCBSTM32F400/TinyCLR_NONET/allocator.cpp
index 372f95138..03d64fe12 100644
--- a/Solutions/MCBSTM32F400/TinyCLR_NONET/allocator.cpp
+++ b/Solutions/MCBSTM32F400/TinyCLR_NONET/allocator.cpp
@@ -10,22 +10,35 @@
void *operator new( size_t n )
{
- return private_malloc( n );
+ return malloc( n );
}
void *operator new[]( size_t n )
{
- return private_malloc( n );
+ return malloc( n );
}
void operator delete( void* p )
{
- return private_free( p );
+ return free( p );
}
void operator delete[]( void* p )
{
- return private_free( p );
+ return free( p );
}
////////////////////////////////////////////////////////////////////////////////
+
+// the following remapping seems to be required by the crypto libs, as soon as those are reworked this should be removed
+// remap private_malloc to standard C malloc
+void *private_malloc(size_t size)
+{
+ return malloc(size);
+}
+
+// remap private_free to standard C free
+void private_free(void *ptr)
+{
+ free(ptr);
+}
diff --git a/Solutions/MCBSTM32F400/TinyCLR_NONET/scatterfile_tinyclr_nonet_gcc.xml b/Solutions/MCBSTM32F400/TinyCLR_NONET/scatterfile_tinyclr_nonet_gcc.xml
index c3c7be81f..a9980cf18 100644
--- a/Solutions/MCBSTM32F400/TinyCLR_NONET/scatterfile_tinyclr_nonet_gcc.xml
+++ b/Solutions/MCBSTM32F400/TinyCLR_NONET/scatterfile_tinyclr_nonet_gcc.xml
@@ -70,7 +70,6 @@
-
@@ -80,7 +79,7 @@
with the SWD pins used for ETM tracing in Debug builds.
-->
-
+
@@ -105,19 +104,60 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -197,17 +269,6 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Solutions/MCBSTM32F400/build_gcc.cmd b/Solutions/MCBSTM32F400/build_gcc.cmd
new file mode 100644
index 000000000..f6baecc68
--- /dev/null
+++ b/Solutions/MCBSTM32F400/build_gcc.cmd
@@ -0,0 +1,11 @@
+echo off
+echo Set Environnement variables for GCC
+call E:\GitHub\netmf-interpreter\setenv_gcc 5.4.1 E:\GNU_Tools_ARM_Embedded\5_4_2016q2
+call msbuild /t:rebuild /p:flavor=release;memory=flash /filelogger /flp:verbosity=detailed /clp:verbosity=minimal /maxcpucount
+del E:\GitHub\netmf-interpreter\BuildOutput\THUMB2FP\GCC4.9\le\FLASH\release\STM32F4DISCOVERY\bin\tinyclr.bin\*.bin
+ren E:\GitHub\netmf-interpreter\BuildOutput\THUMB2FP\GCC4.9\le\FLASH\release\STM32F4DISCOVERY\bin\tinyclr.bin\ER_CONFIG ER_CONFIG.bin
+ren E:\GitHub\netmf-interpreter\BuildOutput\THUMB2FP\GCC4.9\le\FLASH\release\STM32F4DISCOVERY\bin\tinyclr.bin\ER_FLASH ER_FLASH.bin
+del E:\GitHub\netmf-interpreter\BuildOutput\THUMB2FP\GCC4.9\le\FLASH\release\STM32F4DISCOVERY\bin\tinyclr.hex\*.hex
+ren E:\GitHub\netmf-interpreter\BuildOutput\THUMB2FP\GCC4.9\le\FLASH\release\STM32F4DISCOVERY\bin\tinyclr.hex\ER_CONFIG ER_CONFIG.hex
+ren E:\GitHub\netmf-interpreter\BuildOutput\THUMB2FP\GCC4.9\le\FLASH\release\STM32F4DISCOVERY\bin\tinyclr.hex\ER_FLASH ER_FLASH.hex
+pause
\ No newline at end of file
diff --git a/Solutions/MCBSTM32F400/dotnetmf.proj b/Solutions/MCBSTM32F400/dotnetmf.proj
index 0904d3e23..fb7f0e76d 100644
--- a/Solutions/MCBSTM32F400/dotnetmf.proj
+++ b/Solutions/MCBSTM32F400/dotnetmf.proj
@@ -7,7 +7,7 @@
-
+
diff --git a/Solutions/MCBSTM32F400/scatterfile_gcc_missing_symbols.xml b/Solutions/MCBSTM32F400/scatterfile_gcc_missing_symbols.xml
deleted file mode 100644
index 65d649caa..000000000
--- a/Solutions/MCBSTM32F400/scatterfile_gcc_missing_symbols.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Solutions/STM32F429IDISCOVERY/DeviceCode/Initialization/tinyhal.cpp b/Solutions/STM32F429IDISCOVERY/DeviceCode/Initialization/tinyhal.cpp
index a81e9ebdf..29663c3c2 100644
--- a/Solutions/STM32F429IDISCOVERY/DeviceCode/Initialization/tinyhal.cpp
+++ b/Solutions/STM32F429IDISCOVERY/DeviceCode/Initialization/tinyhal.cpp
@@ -24,44 +24,6 @@
#undef DEBUG_TRACE
#define DEBUG_TRACE (TRACE_ALWAYS)
-// these define the region to zero initialize
-extern UINT32 Image$$ER_RAM_RW$$ZI$$Base;
-extern UINT32 Image$$ER_RAM_RW$$ZI$$Length;
-
-// here is the execution address/length of code to move from FLASH to RAM
-#define IMAGE_RAM_RO_BASE Image$$ER_RAM_RO$$Base
-#define IMAGE_RAM_RO_LENGTH Image$$ER_RAM_RO$$Length
-
-extern UINT32 IMAGE_RAM_RO_BASE;
-extern UINT32 IMAGE_RAM_RO_LENGTH;
-
-// here is the execution address/length of data to move from FLASH to RAM
-extern UINT32 Image$$ER_RAM_RW$$Base;
-extern UINT32 Image$$ER_RAM_RW$$Length;
-
-// here is the load address of the RAM code/data
-#define LOAD_RAM_RO_BASE Load$$ER_RAM_RO$$Base
-
-extern UINT32 LOAD_RAM_RO_BASE;
-extern UINT32 Load$$ER_RAM_RW$$Base;
-
-#if defined(TARGETLOCATION_RAM)
-
-extern UINT32 Load$$ER_RAM$$Base;
-extern UINT32 Image$$ER_RAM$$Length;
-
-#elif defined(TARGETLOCATION_FLASH)
-
-extern UINT32 Load$$ER_FLASH$$Base;
-extern UINT32 Image$$ER_FLASH$$Length;
-
-#else
- !ERROR
-#endif
-
-UINT32 LOAD_IMAGE_Start;
-UINT32 LOAD_IMAGE_Length;
-UINT32 LOAD_IMAGE_CalcCRC;
#if defined(PLATFORM_ARM_OS_PORT) && defined(TCPIP_LWIP_OS)
extern UINT32 Load$$ER_LWIP_OS$$RW$$Base;
@@ -124,56 +86,6 @@ static void __section("SectionForBootstrapOperations") Prepare_Zero( UINT32* dst
}
}
-#if !defined(PLATFORM_ARM_OS_PORT) || defined(__GNUC__)
-void __section("SectionForBootstrapOperations") PrepareImageRegions()
-{
- //
- // Copy RAM RO regions into proper location.
- //
- {
- UINT32* src = (UINT32*)&LOAD_RAM_RO_BASE;
- UINT32* dst = (UINT32*)&IMAGE_RAM_RO_BASE;
- UINT32 len = (UINT32 )&IMAGE_RAM_RO_LENGTH;
-
- Prepare_Copy( src, dst, len );
- }
-
- //
- // Copy RAM RW regions into proper location.
- //
- {
- UINT32* src = (UINT32*)&Load$$ER_RAM_RW$$Base;
- UINT32* dst = (UINT32*)&Image$$ER_RAM_RW$$Base;
- UINT32 len = (UINT32)&Image$$ER_RAM_RW$$Length;
-
- Prepare_Copy( src, dst, len );
- }
-
- //
- // Initialize RAM ZI regions.
- //
- {
- UINT32* dst = (UINT32*)&Image$$ER_RAM_RW$$ZI$$Base;
- UINT32 len = (UINT32 )&Image$$ER_RAM_RW$$ZI$$Length;
-
- Prepare_Zero( dst, len );
- }
-}
-#else
-extern "C" void PrepareImageRegions()
-{
- // This space intentionally left blank... 8^)
- //
- // The OS boot of CLR on CMSIS-RTX doesn't
- // use this as it relies on the C/C++ runtime
- // to handle initialization. However, to keep
- // from adding more libraries or #if checks
- // in code this is defined to allow normal
- // linking with the same HAL libs used in a
- // boot loader.
-}
-#endif
-
#pragma arm section code
//--//
@@ -276,7 +188,7 @@ void HAL_EnterBooterMode()
::Watchdog_ResetCounter();
- BYTE *data = (BYTE*) private_malloc(pBlockRegionInfo->BytesPerBlock);
+ BYTE *data = (BYTE*) malloc(pBlockRegionInfo->BytesPerBlock);
if(data != NULL)
{
@@ -305,7 +217,7 @@ void HAL_EnterBooterMode()
// write back to sector, as we only change one bit from 0 to 1, no need to erase sector
bRet = (TRUE == pBlockDevice->Write( configSectAddress, pBlockRegionInfo->BytesPerBlock, data, FALSE ));
- private_free(data);
+ free(data);
}
}
@@ -331,8 +243,6 @@ void HAL_Initialize()
HAL_CONTINUATION::InitializeList();
HAL_COMPLETION ::InitializeList();
- HAL_Init_Custom_Heap();
-
Time_Initialize();
Events_Initialize();
@@ -512,55 +422,10 @@ void HAL_Uninitialize()
extern "C"
{
-#if defined( __GNUC__ )
- extern "C++" int main(void);
- extern void __libc_init_array();
- void __main()
- {
- // Copy writeable data and zero init BSS
- PrepareImageRegions();
-
- // Call static constructors
- __libc_init_array();
-
- // Call the application's entry point.
- main();
- }
-#endif
#if !defined(PLATFORM_ARM_OS_PORT)
void BootEntry()
{
-#if !defined(BUILD_RTM)
- {
- int marker;
- int* ptr = &marker - 1; // This will point to the current top of the stack.
- int* end = &StackBottom;
-
- while(ptr >= end)
- {
- *ptr-- = 0xBAADF00D;
- }
- }
-#endif
-
- // these are needed for patch access
-
-#if defined(TARGETLOCATION_RAM)
-
- LOAD_IMAGE_Start = (UINT32)&Load$$ER_RAM$$Base;
- LOAD_IMAGE_Length = (UINT32)&Image$$ER_RAM$$Length;
-
-#elif defined(TARGETLOCATION_FLASH)
-
- LOAD_IMAGE_Start = (UINT32)&Load$$ER_FLASH$$Base;
- LOAD_IMAGE_Length = (UINT32)&Image$$ER_FLASH$$Length;
-
-#else
- !ERROR
-#endif
-
- LOAD_IMAGE_Length += (UINT32)&IMAGE_RAM_RO_LENGTH + (UINT32)&Image$$ER_RAM_RW$$Length;
#if !defined(BUILD_RTM)
g_Boot_RAMConstants_CRC = Checksum_RAMConstants();
@@ -582,12 +447,6 @@ void BootEntry()
DEBUG_TRACE1(TRACE_ALWAYS, "ARM Compiler version %d\r\n", __ARMCC_VERSION);
#endif
- UINT8* BaseAddress;
- UINT32 SizeInBytes;
-
- HeapLocation( BaseAddress, SizeInBytes );
- memset ( BaseAddress, 0, SizeInBytes );
-
debug_printf("\f");
debug_printf("%-15s\r\n", HalName);
@@ -629,7 +488,7 @@ void BootEntry()
#if defined(PLATFORM_ARM_OS_PORT)
-extern "C" void STM32F4_BootstrapCode();
+extern "C" void BootstrapCode();
// performs base level system initialization
// This typically consists of setting up clocks
@@ -647,7 +506,7 @@ extern "C" void STM32F4_BootstrapCode();
// as the kernel isn't initialized yet either.
extern "C" void SystemInit()
{
- STM32F4_BootstrapCode();
+ BootstrapCode();
CPU_Initialize();
__enable_irq();
}
@@ -685,76 +544,3 @@ void lcd_printf( const char* format, ... )
}
#endif // !defined(BUILD_RTM)
-
-#if !defined(BUILD_RTM)
-
-UINT32 Checksum_RAMConstants()
-{
- UINT32* RAMConstants = (UINT32*)&IMAGE_RAM_RO_BASE;
- UINT32 Length = (UINT32 )&IMAGE_RAM_RO_LENGTH;
-
- UINT32 crc;
-
- // start with Vector area CRC
- crc = SUPPORT_ComputeCRC(NULL, 0x00000020, 0);
-
- // add the big block of RAM constants to CRC
- crc = SUPPORT_ComputeCRC(RAMConstants, Length, crc);
-
- return crc;
-}
-
-void Verify_RAMConstants( void* arg )
-{
- BOOL BreakpointOnError = (BOOL)arg;
-
- //debug_printf("RAMC\r\n");
-
- UINT32 crc = Checksum_RAMConstants();
-
- if (crc != g_Boot_RAMConstants_CRC)
- {
- hal_printf("RAMC CRC:%08x!=%08x\r\n", crc, g_Boot_RAMConstants_CRC);
-
- UINT32* ROMConstants = (UINT32*)&LOAD_RAM_RO_BASE;
- UINT32* RAMConstants = (UINT32*)&IMAGE_RAM_RO_BASE;
- UINT32 Length = (UINT32 )&IMAGE_RAM_RO_LENGTH;
- BOOL FoundMismatch = FALSE;
-
- for(int i = 0; i < Length; i += 4)
- {
- if(*RAMConstants != *ROMConstants)
- {
- hal_printf( "RAMC %08x:%08x!=%08x\r\n", (UINT32) RAMConstants, *RAMConstants, *ROMConstants );
-
- if(!FoundMismatch) lcd_printf( "\fRAMC:%08x\r\n", (UINT32)RAMConstants ); // first one only to LCD
- FoundMismatch = TRUE;
- }
-
- RAMConstants++;
- ROMConstants++;
- }
-
- if(!FoundMismatch)
- {
- // the vector area must have been trashed
- lcd_printf("\fRAMC:%08x\r\n", (UINT32) NULL);
- RAMConstants = (UINT32*)NULL;
-
- for(int i = 0; i < 32; i += 4)
- {
- hal_printf( "RAMC %02x:%08x\r\n", i, *RAMConstants );
- lcd_printf( "%02x:%08x\r\n" , i, *RAMConstants++ );
- }
- }
-
- DebuggerPort_Flush( HalSystemConfig.DebugTextPort );
-
- if(BreakpointOnError)
- {
- HARD_BREAKPOINT();
- }
- }
-}
-
-#endif // !defined(BUILD_RTM)
diff --git a/Solutions/STM32F429IDISCOVERY/STM32F429IDISCOVERY.settings b/Solutions/STM32F429IDISCOVERY/STM32F429IDISCOVERY.settings
index e3f266ea0..41d37d7a9 100644
--- a/Solutions/STM32F429IDISCOVERY/STM32F429IDISCOVERY.settings
+++ b/Solutions/STM32F429IDISCOVERY/STM32F429IDISCOVERY.settings
@@ -16,6 +16,7 @@
True
le
true
+ true
STM32F429IDISCOVERY by CW2
diff --git a/Solutions/STM32F429IDISCOVERY/TinyBooter/TinyBooter.proj b/Solutions/STM32F429IDISCOVERY/TinyBooter/TinyBooter.proj
index d26cd7174..704a44650 100644
--- a/Solutions/STM32F429IDISCOVERY/TinyBooter/TinyBooter.proj
+++ b/Solutions/STM32F429IDISCOVERY/TinyBooter/TinyBooter.proj
@@ -24,6 +24,8 @@
$(ExtraTargets);CompressBin
scatterfile_bootloader_$(COMPILER_TOOL).$(SCATTER_EXT)
scatterfile_bootloader_$(COMPILER_TOOL).$(SCATTER_EXT)
+
+ true
@@ -146,14 +148,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/STM32F429IDISCOVERY/TinyBooter/allocator.cpp b/Solutions/STM32F429IDISCOVERY/TinyBooter/allocator.cpp
index 59ddd068e..4336cb48d 100644
--- a/Solutions/STM32F429IDISCOVERY/TinyBooter/allocator.cpp
+++ b/Solutions/STM32F429IDISCOVERY/TinyBooter/allocator.cpp
@@ -41,3 +41,16 @@ void operator delete[] (void*)
}
////////////////////////////////////////////////////////////////////////////////
+
+// the following remapping seems to be required by the crypto libs, as soon as those are reworked this should be removed
+// remap private_malloc to standard C malloc
+void *private_malloc(size_t size)
+{
+ return malloc(size);
+}
+
+// remap private_free to standard C free
+void private_free(void *ptr)
+{
+ free(ptr);
+}
diff --git a/Solutions/STM32F429IDISCOVERY/TinyBooter/scatterfile_bootloader_gcc.xml b/Solutions/STM32F429IDISCOVERY/TinyBooter/scatterfile_bootloader_gcc.xml
index a43701875..7ed13b14c 100644
--- a/Solutions/STM32F429IDISCOVERY/TinyBooter/scatterfile_bootloader_gcc.xml
+++ b/Solutions/STM32F429IDISCOVERY/TinyBooter/scatterfile_bootloader_gcc.xml
@@ -43,12 +43,9 @@
-
-
-
-
-
-
+
+
+
@@ -72,17 +69,59 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
-
+
+
+
+
+
-
-
+
-
-
+
+
+
+
+
+
-
+
-
-
-
+
-
-
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Solutions/STM32F429IDISCOVERY/TinyCLR/TinyCLR.proj b/Solutions/STM32F429IDISCOVERY/TinyCLR/TinyCLR.proj
index 144360047..b71d3373f 100644
--- a/Solutions/STM32F429IDISCOVERY/TinyCLR/TinyCLR.proj
+++ b/Solutions/STM32F429IDISCOVERY/TinyCLR/TinyCLR.proj
@@ -32,7 +32,7 @@
TinyClr_Dat_Start
g_ConfigurationSector
- false
+ true
@@ -181,14 +181,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/STM32F429IDISCOVERY/TinyCLR/allocator.cpp b/Solutions/STM32F429IDISCOVERY/TinyCLR/allocator.cpp
index 372f95138..03d64fe12 100644
--- a/Solutions/STM32F429IDISCOVERY/TinyCLR/allocator.cpp
+++ b/Solutions/STM32F429IDISCOVERY/TinyCLR/allocator.cpp
@@ -10,22 +10,35 @@
void *operator new( size_t n )
{
- return private_malloc( n );
+ return malloc( n );
}
void *operator new[]( size_t n )
{
- return private_malloc( n );
+ return malloc( n );
}
void operator delete( void* p )
{
- return private_free( p );
+ return free( p );
}
void operator delete[]( void* p )
{
- return private_free( p );
+ return free( p );
}
////////////////////////////////////////////////////////////////////////////////
+
+// the following remapping seems to be required by the crypto libs, as soon as those are reworked this should be removed
+// remap private_malloc to standard C malloc
+void *private_malloc(size_t size)
+{
+ return malloc(size);
+}
+
+// remap private_free to standard C free
+void private_free(void *ptr)
+{
+ free(ptr);
+}
diff --git a/Solutions/STM32F429IDISCOVERY/TinyCLR/scatterfile_tinyclr_gcc.xml b/Solutions/STM32F429IDISCOVERY/TinyCLR/scatterfile_tinyclr_gcc.xml
index df984719e..790fa7bc6 100644
--- a/Solutions/STM32F429IDISCOVERY/TinyCLR/scatterfile_tinyclr_gcc.xml
+++ b/Solutions/STM32F429IDISCOVERY/TinyCLR/scatterfile_tinyclr_gcc.xml
@@ -50,12 +50,9 @@
-
-
-
-
-
-
+
+
+
@@ -79,20 +76,61 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -126,40 +193,49 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
+
+
+
-
-
-
-
+
+
-
-
-
-
+
+
-
-
-
+
+
+
+
@@ -167,17 +243,6 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Solutions/STM32F429IDISCOVERY/scatterfile_gcc_missing_symbols.xml b/Solutions/STM32F429IDISCOVERY/scatterfile_gcc_missing_symbols.xml
deleted file mode 100644
index 424b8c97f..000000000
--- a/Solutions/STM32F429IDISCOVERY/scatterfile_gcc_missing_symbols.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Solutions/STM32F4DISCOVERY/DeviceCode/Initialization/tinyhal.cpp b/Solutions/STM32F4DISCOVERY/DeviceCode/Initialization/tinyhal.cpp
index a81e9ebdf..facb63aee 100644
--- a/Solutions/STM32F4DISCOVERY/DeviceCode/Initialization/tinyhal.cpp
+++ b/Solutions/STM32F4DISCOVERY/DeviceCode/Initialization/tinyhal.cpp
@@ -24,44 +24,6 @@
#undef DEBUG_TRACE
#define DEBUG_TRACE (TRACE_ALWAYS)
-// these define the region to zero initialize
-extern UINT32 Image$$ER_RAM_RW$$ZI$$Base;
-extern UINT32 Image$$ER_RAM_RW$$ZI$$Length;
-
-// here is the execution address/length of code to move from FLASH to RAM
-#define IMAGE_RAM_RO_BASE Image$$ER_RAM_RO$$Base
-#define IMAGE_RAM_RO_LENGTH Image$$ER_RAM_RO$$Length
-
-extern UINT32 IMAGE_RAM_RO_BASE;
-extern UINT32 IMAGE_RAM_RO_LENGTH;
-
-// here is the execution address/length of data to move from FLASH to RAM
-extern UINT32 Image$$ER_RAM_RW$$Base;
-extern UINT32 Image$$ER_RAM_RW$$Length;
-
-// here is the load address of the RAM code/data
-#define LOAD_RAM_RO_BASE Load$$ER_RAM_RO$$Base
-
-extern UINT32 LOAD_RAM_RO_BASE;
-extern UINT32 Load$$ER_RAM_RW$$Base;
-
-#if defined(TARGETLOCATION_RAM)
-
-extern UINT32 Load$$ER_RAM$$Base;
-extern UINT32 Image$$ER_RAM$$Length;
-
-#elif defined(TARGETLOCATION_FLASH)
-
-extern UINT32 Load$$ER_FLASH$$Base;
-extern UINT32 Image$$ER_FLASH$$Length;
-
-#else
- !ERROR
-#endif
-
-UINT32 LOAD_IMAGE_Start;
-UINT32 LOAD_IMAGE_Length;
-UINT32 LOAD_IMAGE_CalcCRC;
#if defined(PLATFORM_ARM_OS_PORT) && defined(TCPIP_LWIP_OS)
extern UINT32 Load$$ER_LWIP_OS$$RW$$Base;
@@ -124,64 +86,10 @@ static void __section("SectionForBootstrapOperations") Prepare_Zero( UINT32* dst
}
}
-#if !defined(PLATFORM_ARM_OS_PORT) || defined(__GNUC__)
-void __section("SectionForBootstrapOperations") PrepareImageRegions()
-{
- //
- // Copy RAM RO regions into proper location.
- //
- {
- UINT32* src = (UINT32*)&LOAD_RAM_RO_BASE;
- UINT32* dst = (UINT32*)&IMAGE_RAM_RO_BASE;
- UINT32 len = (UINT32 )&IMAGE_RAM_RO_LENGTH;
-
- Prepare_Copy( src, dst, len );
- }
-
- //
- // Copy RAM RW regions into proper location.
- //
- {
- UINT32* src = (UINT32*)&Load$$ER_RAM_RW$$Base;
- UINT32* dst = (UINT32*)&Image$$ER_RAM_RW$$Base;
- UINT32 len = (UINT32)&Image$$ER_RAM_RW$$Length;
-
- Prepare_Copy( src, dst, len );
- }
-
- //
- // Initialize RAM ZI regions.
- //
- {
- UINT32* dst = (UINT32*)&Image$$ER_RAM_RW$$ZI$$Base;
- UINT32 len = (UINT32 )&Image$$ER_RAM_RW$$ZI$$Length;
-
- Prepare_Zero( dst, len );
- }
-}
-#else
-extern "C" void PrepareImageRegions()
-{
- // This space intentionally left blank... 8^)
- //
- // The OS boot of CLR on CMSIS-RTX doesn't
- // use this as it relies on the C/C++ runtime
- // to handle initialization. However, to keep
- // from adding more libraries or #if checks
- // in code this is defined to allow normal
- // linking with the same HAL libs used in a
- // boot loader.
-}
-#endif
-
#pragma arm section code
//--//
-#if !defined(BUILD_RTM)
-static UINT32 g_Boot_RAMConstants_CRC = 0;
-#endif
-
static ON_SOFT_REBOOT_HANDLER s_rebootHandlers[16] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
void HAL_AddSoftRebootHandler(ON_SOFT_REBOOT_HANDLER handler)
@@ -276,7 +184,7 @@ void HAL_EnterBooterMode()
::Watchdog_ResetCounter();
- BYTE *data = (BYTE*) private_malloc(pBlockRegionInfo->BytesPerBlock);
+ BYTE *data = (BYTE*) malloc(pBlockRegionInfo->BytesPerBlock);
if(data != NULL)
{
@@ -305,7 +213,7 @@ void HAL_EnterBooterMode()
// write back to sector, as we only change one bit from 0 to 1, no need to erase sector
bRet = (TRUE == pBlockDevice->Write( configSectAddress, pBlockRegionInfo->BytesPerBlock, data, FALSE ));
- private_free(data);
+ free(data);
}
}
@@ -316,7 +224,7 @@ void HAL_EnterBooterMode()
bool g_fDoNotUninitializeDebuggerPort = false;
void HAL_Initialize()
-{
+{
#if defined(PLATFORM_ARM_OS_PORT)
// Interrupts must be enabled to handle calls to OS
// (Network stack uses the CMSIS-RTX OS, which uses
@@ -331,8 +239,6 @@ void HAL_Initialize()
HAL_CONTINUATION::InitializeList();
HAL_COMPLETION ::InitializeList();
- HAL_Init_Custom_Heap();
-
Time_Initialize();
Events_Initialize();
@@ -512,61 +418,10 @@ void HAL_Uninitialize()
extern "C"
{
-#if defined( __GNUC__ )
- extern "C++" int main(void);
- extern void __libc_init_array();
- void __main()
- {
- // Copy writeable data and zero init BSS
- PrepareImageRegions();
-
- // Call static constructors
- __libc_init_array();
-
- // Call the application's entry point.
- main();
- }
-#endif
#if !defined(PLATFORM_ARM_OS_PORT)
void BootEntry()
{
-#if !defined(BUILD_RTM)
- {
- int marker;
- int* ptr = &marker - 1; // This will point to the current top of the stack.
- int* end = &StackBottom;
-
- while(ptr >= end)
- {
- *ptr-- = 0xBAADF00D;
- }
- }
-#endif
-
- // these are needed for patch access
-
-#if defined(TARGETLOCATION_RAM)
-
- LOAD_IMAGE_Start = (UINT32)&Load$$ER_RAM$$Base;
- LOAD_IMAGE_Length = (UINT32)&Image$$ER_RAM$$Length;
-
-#elif defined(TARGETLOCATION_FLASH)
-
- LOAD_IMAGE_Start = (UINT32)&Load$$ER_FLASH$$Base;
- LOAD_IMAGE_Length = (UINT32)&Image$$ER_FLASH$$Length;
-
-#else
- !ERROR
-#endif
-
- LOAD_IMAGE_Length += (UINT32)&IMAGE_RAM_RO_LENGTH + (UINT32)&Image$$ER_RAM_RW$$Length;
-
-#if !defined(BUILD_RTM)
- g_Boot_RAMConstants_CRC = Checksum_RAMConstants();
-#endif
-
-
CPU_Initialize();
HAL_Time_Initialize();
@@ -582,12 +437,6 @@ void BootEntry()
DEBUG_TRACE1(TRACE_ALWAYS, "ARM Compiler version %d\r\n", __ARMCC_VERSION);
#endif
- UINT8* BaseAddress;
- UINT32 SizeInBytes;
-
- HeapLocation( BaseAddress, SizeInBytes );
- memset ( BaseAddress, 0, SizeInBytes );
-
debug_printf("\f");
debug_printf("%-15s\r\n", HalName);
@@ -628,8 +477,7 @@ void BootEntry()
} // extern "C"
-#if defined(PLATFORM_ARM_OS_PORT)
-extern "C" void STM32F4_BootstrapCode();
+extern "C" void BootstrapCode();
// performs base level system initialization
// This typically consists of setting up clocks
@@ -647,13 +495,11 @@ extern "C" void STM32F4_BootstrapCode();
// as the kernel isn't initialized yet either.
extern "C" void SystemInit()
{
- STM32F4_BootstrapCode();
+ BootstrapCode();
CPU_Initialize();
__enable_irq();
}
-#endif //PLATFORM_ARM_OS_PORT
-
#if !defined(BUILD_RTM)
void debug_printf( const char* format, ... )
@@ -685,76 +531,3 @@ void lcd_printf( const char* format, ... )
}
#endif // !defined(BUILD_RTM)
-
-#if !defined(BUILD_RTM)
-
-UINT32 Checksum_RAMConstants()
-{
- UINT32* RAMConstants = (UINT32*)&IMAGE_RAM_RO_BASE;
- UINT32 Length = (UINT32 )&IMAGE_RAM_RO_LENGTH;
-
- UINT32 crc;
-
- // start with Vector area CRC
- crc = SUPPORT_ComputeCRC(NULL, 0x00000020, 0);
-
- // add the big block of RAM constants to CRC
- crc = SUPPORT_ComputeCRC(RAMConstants, Length, crc);
-
- return crc;
-}
-
-void Verify_RAMConstants( void* arg )
-{
- BOOL BreakpointOnError = (BOOL)arg;
-
- //debug_printf("RAMC\r\n");
-
- UINT32 crc = Checksum_RAMConstants();
-
- if (crc != g_Boot_RAMConstants_CRC)
- {
- hal_printf("RAMC CRC:%08x!=%08x\r\n", crc, g_Boot_RAMConstants_CRC);
-
- UINT32* ROMConstants = (UINT32*)&LOAD_RAM_RO_BASE;
- UINT32* RAMConstants = (UINT32*)&IMAGE_RAM_RO_BASE;
- UINT32 Length = (UINT32 )&IMAGE_RAM_RO_LENGTH;
- BOOL FoundMismatch = FALSE;
-
- for(int i = 0; i < Length; i += 4)
- {
- if(*RAMConstants != *ROMConstants)
- {
- hal_printf( "RAMC %08x:%08x!=%08x\r\n", (UINT32) RAMConstants, *RAMConstants, *ROMConstants );
-
- if(!FoundMismatch) lcd_printf( "\fRAMC:%08x\r\n", (UINT32)RAMConstants ); // first one only to LCD
- FoundMismatch = TRUE;
- }
-
- RAMConstants++;
- ROMConstants++;
- }
-
- if(!FoundMismatch)
- {
- // the vector area must have been trashed
- lcd_printf("\fRAMC:%08x\r\n", (UINT32) NULL);
- RAMConstants = (UINT32*)NULL;
-
- for(int i = 0; i < 32; i += 4)
- {
- hal_printf( "RAMC %02x:%08x\r\n", i, *RAMConstants );
- lcd_printf( "%02x:%08x\r\n" , i, *RAMConstants++ );
- }
- }
-
- DebuggerPort_Flush( HalSystemConfig.DebugTextPort );
-
- if(BreakpointOnError)
- {
- HARD_BREAKPOINT();
- }
- }
-}
-
-#endif // !defined(BUILD_RTM)
diff --git a/Solutions/STM32F4DISCOVERY/STM32F4DISCOVERY.settings b/Solutions/STM32F4DISCOVERY/STM32F4DISCOVERY.settings
index a2a5d139c..82c3da8a5 100644
--- a/Solutions/STM32F4DISCOVERY/STM32F4DISCOVERY.settings
+++ b/Solutions/STM32F4DISCOVERY/STM32F4DISCOVERY.settings
@@ -16,6 +16,7 @@
True
le
true
+ true
diff --git a/Solutions/STM32F4DISCOVERY/TinyBooter/TinyBooter.proj b/Solutions/STM32F4DISCOVERY/TinyBooter/TinyBooter.proj
index d8c4f5188..f2f6df953 100644
--- a/Solutions/STM32F4DISCOVERY/TinyBooter/TinyBooter.proj
+++ b/Solutions/STM32F4DISCOVERY/TinyBooter/TinyBooter.proj
@@ -23,6 +23,8 @@
$(ExtraTargets);CompressBin
scatterfile_bootloader_$(COMPILER_TOOL).$(SCATTER_EXT)
scatterfile_bootloader_$(COMPILER_TOOL).$(SCATTER_EXT)
+
+ true
@@ -145,14 +147,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/STM32F4DISCOVERY/TinyBooter/allocator.cpp b/Solutions/STM32F4DISCOVERY/TinyBooter/allocator.cpp
index 59ddd068e..4336cb48d 100644
--- a/Solutions/STM32F4DISCOVERY/TinyBooter/allocator.cpp
+++ b/Solutions/STM32F4DISCOVERY/TinyBooter/allocator.cpp
@@ -41,3 +41,16 @@ void operator delete[] (void*)
}
////////////////////////////////////////////////////////////////////////////////
+
+// the following remapping seems to be required by the crypto libs, as soon as those are reworked this should be removed
+// remap private_malloc to standard C malloc
+void *private_malloc(size_t size)
+{
+ return malloc(size);
+}
+
+// remap private_free to standard C free
+void private_free(void *ptr)
+{
+ free(ptr);
+}
diff --git a/Solutions/STM32F4DISCOVERY/TinyBooter/scatterfile_bootloader_gcc.xml b/Solutions/STM32F4DISCOVERY/TinyBooter/scatterfile_bootloader_gcc.xml
index 9b7ada5df..f3129408d 100644
--- a/Solutions/STM32F4DISCOVERY/TinyBooter/scatterfile_bootloader_gcc.xml
+++ b/Solutions/STM32F4DISCOVERY/TinyBooter/scatterfile_bootloader_gcc.xml
@@ -43,12 +43,9 @@
-
-
-
-
-
-
+
+
+
@@ -72,17 +69,59 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
@@ -105,62 +154,72 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
-
-
+
+
+
+
+
+
-
+
-
-
-
+
-
-
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Solutions/STM32F4DISCOVERY/TinyCLR/TinyCLR.proj b/Solutions/STM32F4DISCOVERY/TinyCLR/TinyCLR.proj
index bb8254842..ff01ea1b0 100644
--- a/Solutions/STM32F4DISCOVERY/TinyCLR/TinyCLR.proj
+++ b/Solutions/STM32F4DISCOVERY/TinyCLR/TinyCLR.proj
@@ -31,7 +31,7 @@
TinyClr_Dat_Start
g_ConfigurationSector
- false
+ true
@@ -180,14 +180,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/STM32F4DISCOVERY/TinyCLR/allocator.cpp b/Solutions/STM32F4DISCOVERY/TinyCLR/allocator.cpp
index 372f95138..03d64fe12 100644
--- a/Solutions/STM32F4DISCOVERY/TinyCLR/allocator.cpp
+++ b/Solutions/STM32F4DISCOVERY/TinyCLR/allocator.cpp
@@ -10,22 +10,35 @@
void *operator new( size_t n )
{
- return private_malloc( n );
+ return malloc( n );
}
void *operator new[]( size_t n )
{
- return private_malloc( n );
+ return malloc( n );
}
void operator delete( void* p )
{
- return private_free( p );
+ return free( p );
}
void operator delete[]( void* p )
{
- return private_free( p );
+ return free( p );
}
////////////////////////////////////////////////////////////////////////////////
+
+// the following remapping seems to be required by the crypto libs, as soon as those are reworked this should be removed
+// remap private_malloc to standard C malloc
+void *private_malloc(size_t size)
+{
+ return malloc(size);
+}
+
+// remap private_free to standard C free
+void private_free(void *ptr)
+{
+ free(ptr);
+}
diff --git a/Solutions/STM32F4DISCOVERY/TinyCLR/scatterfile_tinyclr_gcc.xml b/Solutions/STM32F4DISCOVERY/TinyCLR/scatterfile_tinyclr_gcc.xml
index ad604bb70..b1b4a75c5 100644
--- a/Solutions/STM32F4DISCOVERY/TinyCLR/scatterfile_tinyclr_gcc.xml
+++ b/Solutions/STM32F4DISCOVERY/TinyCLR/scatterfile_tinyclr_gcc.xml
@@ -48,14 +48,11 @@
-
+
-
-
-
-
-
-
+
+
+
@@ -77,22 +74,63 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
+
-
-
-
+
-
-
-
-
+
+
-
-
-
-
+
+
-
-
-
+
+
+
+
@@ -167,17 +237,6 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Solutions/STM32F4DISCOVERY/scatterfile_gcc_missing_symbols.xml b/Solutions/STM32F4DISCOVERY/scatterfile_gcc_missing_symbols.xml
deleted file mode 100644
index 65d649caa..000000000
--- a/Solutions/STM32F4DISCOVERY/scatterfile_gcc_missing_symbols.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Solutions/Template/PortBooter/portBooter.cpp b/Solutions/Template/PortBooter/portBooter.cpp
index 53328c034..61a41b02f 100644
--- a/Solutions/Template/PortBooter/portBooter.cpp
+++ b/Solutions/Template/PortBooter/portBooter.cpp
@@ -710,8 +710,6 @@ XREC_Handler g_XREC;
//--//
-HAL_DECLARE_NULL_HEAP();
-
void ApplicationEntryPoint()
{
UINT32 ComEvent;
diff --git a/Solutions/Template/PortBooter/portBooter.proj b/Solutions/Template/PortBooter/portBooter.proj
index 687ff2d1e..169a4c3f5 100644
--- a/Solutions/Template/PortBooter/portBooter.proj
+++ b/Solutions/Template/PortBooter/portBooter.proj
@@ -85,14 +85,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/Template/PortBooter/portBooterLoader.cpp b/Solutions/Template/PortBooter/portBooterLoader.cpp
index ffd2a1482..f80d71f93 100644
--- a/Solutions/Template/PortBooter/portBooterLoader.cpp
+++ b/Solutions/Template/PortBooter/portBooterLoader.cpp
@@ -13,8 +13,6 @@ typedef unsigned char UINT8;
int LZ77_Decompress( UINT8* inBuf, int inSize, UINT8* outBuf, int outSize );
-HAL_DECLARE_NULL_HEAP();
-
extern "C"
{
void BootEntryLoader()
diff --git a/Solutions/Template/PortBooter/portBooterloader.proj b/Solutions/Template/PortBooter/portBooterloader.proj
index b6ee84757..f00bbf011 100644
--- a/Solutions/Template/PortBooter/portBooterloader.proj
+++ b/Solutions/Template/PortBooter/portBooterloader.proj
@@ -82,14 +82,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/Template/TinyBooter/TinyBooter.proj b/Solutions/Template/TinyBooter/TinyBooter.proj
index 6ac4f5fc9..146aa440c 100644
--- a/Solutions/Template/TinyBooter/TinyBooter.proj
+++ b/Solutions/Template/TinyBooter/TinyBooter.proj
@@ -91,14 +91,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/Template/TinyBooter/TinyBooterDecompressor.proj b/Solutions/Template/TinyBooter/TinyBooterDecompressor.proj
index f0a0b59ee..49d713df3 100644
--- a/Solutions/Template/TinyBooter/TinyBooterDecompressor.proj
+++ b/Solutions/Template/TinyBooter/TinyBooterDecompressor.proj
@@ -91,14 +91,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/Template/TinyCLR/TinyCLR.proj b/Solutions/Template/TinyCLR/TinyCLR.proj
index 70319017c..d5ea436a9 100644
--- a/Solutions/Template/TinyCLR/TinyCLR.proj
+++ b/Solutions/Template/TinyCLR/TinyCLR.proj
@@ -115,14 +115,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/Template_BE/NativeSample/NativeSample.cpp b/Solutions/Template_BE/NativeSample/NativeSample.cpp
index 8fb075b38..466b6780c 100644
--- a/Solutions/Template_BE/NativeSample/NativeSample.cpp
+++ b/Solutions/Template_BE/NativeSample/NativeSample.cpp
@@ -8,8 +8,6 @@
//--//
-HAL_DECLARE_NULL_HEAP();
-
void ApplicationEntryPoint()
{
BOOL result;
diff --git a/Solutions/Template_BE/NativeSample/NativeSample.proj b/Solutions/Template_BE/NativeSample/NativeSample.proj
index b88e58eb0..a003d45af 100644
--- a/Solutions/Template_BE/NativeSample/NativeSample.proj
+++ b/Solutions/Template_BE/NativeSample/NativeSample.proj
@@ -77,14 +77,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/Template_BE/PortBooter/portBooter.cpp b/Solutions/Template_BE/PortBooter/portBooter.cpp
index 53328c034..61a41b02f 100644
--- a/Solutions/Template_BE/PortBooter/portBooter.cpp
+++ b/Solutions/Template_BE/PortBooter/portBooter.cpp
@@ -710,8 +710,6 @@ XREC_Handler g_XREC;
//--//
-HAL_DECLARE_NULL_HEAP();
-
void ApplicationEntryPoint()
{
UINT32 ComEvent;
diff --git a/Solutions/Template_BE/PortBooter/portBooter.proj b/Solutions/Template_BE/PortBooter/portBooter.proj
index 133c34dba..b22cdc04c 100644
--- a/Solutions/Template_BE/PortBooter/portBooter.proj
+++ b/Solutions/Template_BE/PortBooter/portBooter.proj
@@ -89,14 +89,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/Template_BE/PortBooter/portBooterLoader.cpp b/Solutions/Template_BE/PortBooter/portBooterLoader.cpp
index ffd2a1482..f80d71f93 100644
--- a/Solutions/Template_BE/PortBooter/portBooterLoader.cpp
+++ b/Solutions/Template_BE/PortBooter/portBooterLoader.cpp
@@ -13,8 +13,6 @@ typedef unsigned char UINT8;
int LZ77_Decompress( UINT8* inBuf, int inSize, UINT8* outBuf, int outSize );
-HAL_DECLARE_NULL_HEAP();
-
extern "C"
{
void BootEntryLoader()
diff --git a/Solutions/Template_BE/PortBooter/portBooterloader.proj b/Solutions/Template_BE/PortBooter/portBooterloader.proj
index 553701d40..e8069cbab 100644
--- a/Solutions/Template_BE/PortBooter/portBooterloader.proj
+++ b/Solutions/Template_BE/PortBooter/portBooterloader.proj
@@ -86,14 +86,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/Template_BE/TinyCLR/TinyCLR.proj b/Solutions/Template_BE/TinyCLR/TinyCLR.proj
index fa7ae5888..05b3b5e45 100644
--- a/Solutions/Template_BE/TinyCLR/TinyCLR.proj
+++ b/Solutions/Template_BE/TinyCLR/TinyCLR.proj
@@ -119,14 +119,6 @@
-
-
-
-
-
-
-
-
diff --git a/Solutions/Windows/TinyCLR/TinyCLR.proj b/Solutions/Windows/TinyCLR/TinyCLR.proj
index 894977803..99d8f8478 100644
--- a/Solutions/Windows/TinyCLR/TinyCLR.proj
+++ b/Solutions/Windows/TinyCLR/TinyCLR.proj
@@ -310,11 +310,6 @@
-
-
-
-
-
@@ -476,10 +471,6 @@
-->
-