Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Rework solution configuration and ST CMSIS/HAL integration #434

Open
wants to merge 157 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
24f2951
Update CMSIS to 4.5
josesimoes Feb 16, 2016
b8e2035
revert gitignore to match upstream dev
josesimoes Feb 16, 2016
f698ca2
remove licenses and other txt files from crypto libs
josesimoes Feb 16, 2016
1ef482d
update with crypto lib licenses and other txt
josesimoes Feb 16, 2016
4742b0f
Merge branch 'fix-for-signing-empty-files' into dev
josesimoes Feb 16, 2016
5517cae
Add extension to image files generated with GCC.
josesimoes Feb 17, 2016
c88a711
Merge branch 'dev' of https://github.com/NETMF/netmf-interpreter into…
josesimoes Feb 19, 2016
e4aaaff
Revert changes in adding extension to images built with GCC
josesimoes Feb 23, 2016
feaf5ad
Tweak gcc targets for GCC 5-2015-q4-major
josesimoes Feb 23, 2016
7545679
Revert "Tweak gcc targets for GCC 5-2015-q4-major"
josesimoes Feb 23, 2016
605b8b3
Merge branch 'dev' of https://github.com/NETMF/netmf-interpreter into…
josesimoes Feb 25, 2016
e5756d2
Merge branch 'dev' of https://github.com/NETMF/netmf-interpreter into…
josesimoes Feb 29, 2016
aa6974a
Add folder to work as placeholder for STM32Cube packages
josesimoes Mar 1, 2016
6a815af
Remove comment so script actually downloads the pack file
josesimoes Mar 1, 2016
5e30acd
Update PowerShell script
josesimoes Mar 1, 2016
f31e728
Improve script
josesimoes Mar 2, 2016
354be6e
Several improvement in script
josesimoes Mar 3, 2016
56d718f
Merge branch 'dev' of https://github.com/NETMF/netmf-interpreter into…
josesimoes Mar 3, 2016
8a33df8
Improvements in script
josesimoes Mar 3, 2016
1499e00
Improvements in script
josesimoes Mar 3, 2016
01a0a7b
Update feedback messages
josesimoes Mar 3, 2016
acc540c
Rename SD card commands because some colide with STM32 HAL declarations
josesimoes Mar 4, 2016
f4e40b2
Correct bug in script
josesimoes Mar 5, 2016
ea2655a
Rename FLASH in HAL_SYSTEM_CONFIG because it was coliding with a CMSI…
josesimoes Mar 5, 2016
275d7d9
Rename variable because it was coliding with a CMSIS declaration with…
josesimoes Mar 5, 2016
0e60929
Added project for HAL CMSIS GPIO
sjmneves Mar 11, 2016
957afed
Add CMSIS includes for STM32F4 series
josesimoes Mar 11, 2016
70c50f1
Remove custom heap (as discussed in issue #417)
josesimoes Mar 11, 2016
1a08107
Merge branch 'CMSIS_STM32F4' of https://github.com/Eclo/netmf-interpr…
sjmneves Mar 14, 2016
8659b44
Changed ifdef block for STM32 families
sjmneves Mar 14, 2016
b7bf2b1
Added project for HAL CMSIS I2C
sjmneves Mar 14, 2016
dd4d347
Added project for HAL CMSIS SPI
sjmneves Mar 14, 2016
33ac6dc
Rename file i2c_functions.cpp to I2C_functions.cpp
sjmneves Mar 14, 2016
0257133
Correct comments and projects cleanup
josesimoes Mar 15, 2016
285a06c
Add CMSIS HAL project for STM32F4xx series
josesimoes Mar 15, 2016
c884505
Implemented new "feature selection" approach at solution level
josesimoes Mar 15, 2016
f754d89
Update script to copy USB device library files
josesimoes Mar 15, 2016
ce11b9c
Change define for SPI ports
sjmneves Mar 15, 2016
11a58f9
Improve script
josesimoes Mar 15, 2016
bbf6f2d
Improvements in CMSIS HAL
josesimoes Mar 17, 2016
3122df1
Correct indentations
josesimoes Mar 17, 2016
e8b9e80
Added project for HAL CMSIS USART
sjmneves Mar 17, 2016
12a5e52
Missing file from last commit, defines needed
sjmneves Mar 17, 2016
26568a6
Add back wrongly removed feature project for SPI and I2C
josesimoes Mar 17, 2016
c6575b1
Implement CMSIS time to provide NETMF time base
josesimoes Mar 18, 2016
75813c1
Rework HAL
josesimoes Mar 18, 2016
80d267d
Correct comment
josesimoes Mar 18, 2016
6720441
Enable MCU debug when not building RTM
josesimoes Mar 18, 2016
1c35f1a
- Handle USART/UART interupts
sjmneves Mar 18, 2016
a1e5dde
Implement CMCSIS power
josesimoes Mar 19, 2016
248f369
Cleanup comments
josesimoes Mar 19, 2016
9b30713
Cleanup comments
josesimoes Mar 19, 2016
eb338d8
Remove Groups from Time proj
josesimoes Mar 21, 2016
80a1681
Add function to get USART interrupt enable state (required for PAL)
josesimoes Mar 21, 2016
6a3309b
Add project for USB device (WinUSB)
josesimoes Mar 21, 2016
2863a64
Correct comment
josesimoes Mar 21, 2016
953d387
Project for CMSIS USB implementation
josesimoes Mar 21, 2016
00920e1
Add readme with steps on how to configure a solution
josesimoes Mar 21, 2016
62cf45b
Remove unused file
josesimoes Mar 21, 2016
b9c89f6
Correct file name case
josesimoes Mar 21, 2016
4dde0e6
Implement CMSIS Flash driver
josesimoes Mar 21, 2016
326b149
Correct implementation of CMSIS for MCBSTM32F400 solution
josesimoes Mar 21, 2016
513db50
Make all function "weak"
sjmneves Mar 21, 2016
7ef98aa
Turn all functions "weak"
sjmneves Mar 21, 2016
432b057
Turn all function "weak"
sjmneves Mar 21, 2016
c60bfd8
Turn all function "weak"
sjmneves Mar 21, 2016
b3ce499
Turn all function "weak"
sjmneves Mar 21, 2016
7805bc5
Turn all function "weak"
sjmneves Mar 21, 2016
08de75a
Turn all function "weak"
sjmneves Mar 21, 2016
8235666
Turn all function "weak"
sjmneves Mar 21, 2016
f6f99f8
Correct some typos and formating
josesimoes Mar 21, 2016
e7fa12a
Remove static from methods declaration
josesimoes Mar 22, 2016
ea13a56
Add weak attribute to methods in stub projects
josesimoes Mar 22, 2016
81d91c1
Correct issues with build
josesimoes Mar 22, 2016
d03b241
Add new feature selection: watchdog
josesimoes Mar 22, 2016
a9c6671
Add new feature selection: analog (ADC)
josesimoes Mar 22, 2016
42da12f
Remove CPU EBIU and interrupt management from MCBSTM32F400 projects
josesimoes Mar 22, 2016
dc5a859
Add new feature selection: PWM
josesimoes Mar 22, 2016
af0eac0
Add new feature selection: DA
josesimoes Mar 22, 2016
ede1e10
Remove unused code
josesimoes Mar 22, 2016
4be19f6
Move Itm0GenericPort and g_GenericPorts declaration to start code in …
josesimoes Mar 22, 2016
5edaba0
Add new feature selection: sockets
josesimoes Mar 22, 2016
4164e7e
Add compiler defs to remove calls to USART methods in ComDirector whe…
josesimoes Mar 22, 2016
427ea4b
Add compiler defs to remove calls to Watchdog methods when Watchdog f…
josesimoes Mar 22, 2016
55fd5ef
Add missing lib reference for I2C in bootloader projects
josesimoes Mar 22, 2016
216bf28
Add new feature selection: time service
josesimoes Mar 22, 2016
d7d26b9
Reorganized HAL/PAL projects inclusion order and arrangement for clarity
josesimoes Mar 22, 2016
6bbab7f
Further reorganization of PAL/HAL inclusion in solution projects
josesimoes Mar 22, 2016
cfb566a
Add new feature selection: PAL event
josesimoes Mar 22, 2016
d57af94
Add project with HAL interface for Cortex-M CRC calculation unit
josesimoes Mar 22, 2016
4b242fa
Add comments
josesimoes Mar 22, 2016
21f99d0
Add new features selection: Software CRC and Cortex-M CRC
josesimoes Mar 22, 2016
53441d4
Rework GPIO to make it CMSIS compliant
sjmneves Mar 23, 2016
391b0e8
Clean code
sjmneves Mar 23, 2016
5776492
Rework Initialize and Uninitialize functions to be compliant with CMSIS
sjmneves Mar 23, 2016
062b019
Added arrays size validation
sjmneves Mar 24, 2016
183e154
Rework code to make it CMSIS compliant
sjmneves Mar 24, 2016
1cc11d1
Set NVIC priorities for USART modules
josesimoes Mar 24, 2016
2338239
Correct implementation of interface to hardware CRC calculation unit
josesimoes Apr 5, 2016
65da50a
Correct include path for Analog, PWM and DA features
sjmneves Apr 5, 2016
e093b91
Merge branch 'CMSIS_STM32F4' of https://github.com/Eclo/netmf-interpr…
sjmneves Apr 5, 2016
c658d9e
Added CMSIS Analog, PWM, DA drivers (work in progress)
sjmneves Apr 5, 2016
c8b5519
Add NVIC priorities to processor selector
josesimoes Apr 5, 2016
546fb3a
Update script to copy USB midleware to correct target folder
josesimoes Apr 5, 2016
eec9743
Add ignore path to USB midleware library folders
josesimoes Apr 5, 2016
7b7b7ac
Update TICK_INT_PRIORITY to make it usable in other preprocessor defines
josesimoes Apr 5, 2016
30fe3d7
Move STM32F4xx HAL to correct folder
josesimoes Apr 5, 2016
88b490b
Merge branch 'dev' of https://github.com/NETMF/netmf-interpreter into…
josesimoes Apr 5, 2016
a04cb87
Cleanup unused defines
josesimoes Apr 5, 2016
094fcc2
Complete CMSIS DA driver
sjmneves Apr 5, 2016
f082acd
Merge branch 'CMSIS_STM32F4' of https://github.com/Eclo/netmf-interpr…
sjmneves Apr 5, 2016
15e8f53
Complete CMSIS Analog driver
sjmneves Apr 6, 2016
dee9fdf
Added missing lib I2C_pal
sjmneves Apr 6, 2016
c70699c
Complete CMSIS I2C driver
sjmneves Apr 8, 2016
c05cce5
Correct path
sjmneves Apr 8, 2016
2d26cae
Replace Simple heap calls with standard C malloc() and free()
josesimoes Apr 10, 2016
eb1ddd8
Correct flash field names in HalSystemConfig struct
josesimoes Apr 10, 2016
1e457e7
Add extern declaration for SystemClock_Config
josesimoes Apr 10, 2016
8970159
Remove reference to HAL_DECLARE_CUSTOM_HEAP
josesimoes Apr 10, 2016
c28dd4f
Remove implementation of HAL_CPU_Sleep (is now in Power project)
josesimoes Apr 11, 2016
99ce243
Add missing projects and correct identation
josesimoes Apr 11, 2016
939a0c2
Add missing ref to CRC project
josesimoes Apr 11, 2016
8fd2e18
Several corrections to TinyCLR
josesimoes Apr 11, 2016
409d18a
Corrections of I2C projects/lib refs
josesimoes Apr 11, 2016
7dbce69
Revert changes with SimpleHeap
josesimoes Apr 11, 2016
b16be42
Remove weak declarations from simple heap stubs otherwise the framewo…
josesimoes Apr 11, 2016
ad44f74
Remove unused code and headers from HAL prjs and HAL configuration fi…
josesimoes Apr 12, 2016
b3254ae
Rework GPIO to improve performance and to use only HAL functions
sjmneves Apr 12, 2016
c9dfc6a
Added define for GPIO port pin structer
sjmneves Apr 12, 2016
758f2e3
Correction and improvements in GPIO HAL
josesimoes Apr 12, 2016
ccc9113
Correct comment
josesimoes Apr 13, 2016
23b96c9
Correct order of calls to timers init
josesimoes Apr 13, 2016
0549be9
Further work of USB debug project
josesimoes Apr 15, 2016
2d61ab2
Add flag to force c11 and c++11 code and missing air quotes in includ…
josesimoes Apr 15, 2016
97558f3
Correct interrupt handler function names to match declaration of star…
sjmneves Apr 15, 2016
8bac2f5
Add missing extern "C" decoration to interrupt handlers
sjmneves Apr 15, 2016
7d2e5d9
Move declaration of weak interrupt handlers from startup code to Int_…
sjmneves Apr 15, 2016
3b2523f
Correct property definition to properly add USB config defines
josesimoes Apr 15, 2016
b3687a6
Move startup code to solution folder
josesimoes Apr 18, 2016
95bd0ac
Move compiler defines of HAL/PAL features to Microsoft.SPOT.Features.…
josesimoes Apr 18, 2016
398b75b
Rename CRC feature definition to make it clearer
josesimoes Apr 18, 2016
fa4321a
Remove comments from interrupt handlers at startup code
josesimoes Apr 18, 2016
b8980a5
Add missing ifdef FEATURE_LCD wrapping call to lcd_printf
josesimoes Apr 19, 2016
efd9b01
Correct code with wrong call to USB_OpenStream
josesimoes Apr 20, 2016
b13ff66
Correct comment
josesimoes Apr 20, 2016
23802bf
Merge branch 'dev' of https://github.com/NETMF/netmf-interpreter into…
josesimoes Jul 4, 2016
6c4b911
Merge branch 'dev' of https://github.com/NETMF/netmf-interpreter
josesimoes Aug 25, 2016
e8275c6
Missed last commit
josesimoes Aug 25, 2016
3059af0
Added STM32F429IDISCOVERY solution from https://github.com/NETMF/net…
josesimoes Aug 25, 2016
4f5e6a2
Merge branch 'dev' of https://github.com/NETMF/netmf-interpreter into…
josesimoes Sep 5, 2016
0c9e402
Several updates and improvements in script
josesimoes Sep 5, 2016
9a57217
Add gitignore for Visual Studio Code
josesimoes Sep 7, 2016
3e6e145
Update CMSIS package number to 1.13.0
josesimoes Sep 7, 2016
019b9a1
Add nosys.specs for new lib nano
josesimoes Sep 7, 2016
bbcb109
Rework code to support debug scenarious
josesimoes Sep 20, 2016
f329bc8
Correct implementation of cascading timers for NETMF time base
josesimoes Oct 4, 2016
7d24e1e
Update CRC code to match PR #526
josesimoes Nov 10, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
ipch/
*.VC.db

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json

!/tools/bin/

#uVision
Expand All @@ -53,7 +59,18 @@ ReleaseNotesCrypto.txt
/Solutions/Windows/TinyCLR/FLASH_MEMORY.bin
*.opendb
*.dbgconf
!STM32Cube/ReadMe.m
/tools/DisAsmPE/Debug
/tools/DisAsmPE/DisAsmPE/Debug
/tools/DisAsmPE/NETMF.PE.Metadata/Debug
/tools/DisAsmPE/DisAsmPE/*.txt

# STM32 Cube
STM32Cube/*
!STM32Cube/ReadMe.m

# CMSIS PAL and HAL folders
DeviceCode/Targets/Native/*/HAL_Driver
DeviceCode/Targets/Native/*/USB/STM32_USB_Device_Library
!DeviceCode/Targets/Native/*.proj
!DeviceCode/Targets/Native/*.settings
8 changes: 4 additions & 4 deletions Application/MicroBooter/MicroBooter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// <No description>
//
// Microsoft dotNetMF Project
// Copyright �2004 Microsoft Corporation
// Copyright �2004 Microsoft Corporation
// One Microsoft Way, Redmond, Washington 98052-6399 U.S.A.
// All rights reserved.
// MICROSOFT CONFIDENTIAL
Expand All @@ -22,7 +22,7 @@ BOOL MemStreamSeekBlockAddress( BlockStorageStream &stream, UINT32 address );
static SREC_Handler g_SREC;
#endif

HAL_DECLARE_CUSTOM_HEAP( SimpleHeap_Allocate, SimpleHeap_Release, SimpleHeap_ReAllocate );
//HAL_DECLARE_CUSTOM_HEAP( SimpleHeap_Allocate, SimpleHeap_Release, SimpleHeap_ReAllocate );

#pragma arm section zidata = "s_SystemStates"
static INT32 s_SystemStates[SYSTEM_STATE_TOTAL_STATES];
Expand Down Expand Up @@ -438,8 +438,8 @@ void BootEntryLoader()

HeapLocation( BaseAddress, SizeInBytes );

// Initialize custom heap with heap block returned from CustomHeapLocation
SimpleHeap_Initialize( 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();
Expand Down
4 changes: 4 additions & 0 deletions Application/MicroBooter/SrecProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,19 @@ BOOL SREC_Handler::Process( char c )
{
ApplicationStartAddress str = (ApplicationStartAddress)m_ImageStart;

#ifdef FEATURE_LCD
LCD_Clear();
#endif

DebuggerPort_Uninitialize( HalSystemConfig.DebuggerPorts[0] );

DISABLE_INTERRUPTS();

LCD_Uninitialize();

#ifdef FEATURE_CPUCACHE
CPU_DisableCaches();
#endif

(*str)();
}
Expand Down
57 changes: 36 additions & 21 deletions Application/TinyBooter/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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
{
Expand Down Expand Up @@ -140,7 +140,12 @@ struct BitFieldManager
dataAddr = (volatile FLASH_WORD*)&m_signatureCheck->BitField[ sectorIndex / BITS_PER_UINT32 ];

// read back the

#ifdef FEATURE_CPUCACHE
dataRdAddr = (volatile FLASH_WORD*)CPU_GetUncachableAddress( dataAddr );
#else
dataRdAddr = (volatile FLASH_WORD*)dataAddr;
#endif
data = (*dataRdAddr) & ~( 1ul << (sectorIndex % BITS_PER_UINT32) );

// write directly
Expand All @@ -150,7 +155,7 @@ struct BitFieldManager
else
{
UINT32 length = m_region->BytesPerBlock;
BYTE* dataptr = (BYTE*)private_malloc(length);
BYTE* dataptr = (BYTE*)malloc(length);

if(dataptr != NULL)
{
Expand All @@ -174,7 +179,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);
}

}
Expand Down Expand Up @@ -227,7 +232,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;
Expand All @@ -253,13 +258,17 @@ struct BitFieldManager
m_signatureCheck = &m_skipCfgSectorCheck;
}

private_free(data);
free(data);

}
else // XIP device
{

#ifdef FEATURE_CPUCACHE
configSector = (ConfigurationSector*)CPU_GetUncachableAddress( m_cfgPhysicalAddress ); // global config not in flash for bootloader
#else
configSector = (ConfigurationSector*)m_cfgPhysicalAddress; // global config not in flash for bootloader
#endif

m_signatureCheck = NULL;

Expand Down Expand Up @@ -476,7 +485,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;
}

Expand All @@ -486,7 +495,7 @@ static bool AccessMemory( UINT32 location, UINT32 lengthInBytes, BYTE* buf, int
{
if (mode == AccessMemory_Check)
{
private_free(bufPtr);
free(bufPtr);
}

break;
Expand All @@ -495,7 +504,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;
Expand Down Expand Up @@ -525,18 +534,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)
{
Expand All @@ -545,7 +554,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;
}
Expand Down Expand Up @@ -754,7 +763,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();
Expand All @@ -764,7 +773,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;
}
Expand All @@ -791,7 +800,7 @@ bool Loader_Engine::SignedDataState::VerifySignature( UINT8* signature, UINT32 l

if(!deviceInfo->Attribute.SupportsXIP)
{
private_free(signCheckedAddr);
free(signCheckedAddr);
}

return fret;
Expand Down Expand Up @@ -1076,7 +1085,9 @@ void Loader_Engine::Launch( ApplicationStartAddress startAddress )
if (retAddress != NULL)
startAddress = retAddress;

#ifdef FEATURE_LCD
LCD_Clear();
#endif

DebuggerPort_Flush( m_port );

Expand All @@ -1089,9 +1100,13 @@ void Loader_Engine::Launch( ApplicationStartAddress startAddress )

DISABLE_INTERRUPTS();

#ifdef FEATURE_LCD
LCD_Uninitialize();
#endif

#ifdef FEATURE_CPUCACHE
CPU_DisableCaches();
#endif

if(Tinybooter_ImageIsCompressed())
{
Expand Down Expand Up @@ -1426,8 +1441,8 @@ bool Loader_Engine::Monitor_MemoryMap( WP_Message* msg )
map[ 0 ].m_length = HalSystemConfig.RAM1.Size;
map[ 0 ].m_flags = CLR_DBG_Commands::Monitor_MemoryMap::c_RAM;

map[ 1 ].m_address = HalSystemConfig.FLASH.Base;
map[ 1 ].m_length = HalSystemConfig.FLASH.Size;
map[ 1 ].m_address = HalSystemConfig.FLASH1.Base;
map[ 1 ].m_length = HalSystemConfig.FLASH1.Size;
map[ 1 ].m_flags = CLR_DBG_Commands::Monitor_MemoryMap::c_FLASH;

ReplyToCommand( msg, true, false, map, sizeof(map) );
Expand Down Expand Up @@ -1542,7 +1557,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)
{
Expand Down Expand Up @@ -1582,7 +1597,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;
}
Expand Down
12 changes: 10 additions & 2 deletions Application/TinyBooter/ConfigurationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ void ConfigurationSectorManager::LocateConfigurationSector( UINT32 BlockUsage )
m_fSupportsXIP = TRUE;
m_fUsingRAM = FALSE;
// Get the real address
#ifdef FEATURE_CPUCACHE
m_configurationSector = (ConfigurationSector *)CPU_GetUncachableAddress( m_cfgPhysicalAddress );
#else
m_configurationSector = (ConfigurationSector *)m_cfgPhysicalAddress;
#endif
}
else
{
Expand Down Expand Up @@ -74,7 +78,11 @@ void ConfigurationSectorManager::LoadConfiguration()
if (m_fSupportsXIP)
{
// Get the real address
#ifdef FEATURE_CPUCACHE
m_configurationSector = (ConfigurationSector *)CPU_GetUncachableAddress( m_cfgPhysicalAddress );
#else
m_configurationSector = (ConfigurationSector *)m_cfgPhysicalAddress;
#endif
return ;

}
Expand Down Expand Up @@ -130,7 +138,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)
Expand All @@ -154,7 +162,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);


}
Expand Down
6 changes: 5 additions & 1 deletion Application/TinyBooter/CryptoInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ extern int g_ConfigBufferLength;

CryptoState::CryptoState( UINT32 dataAddress, UINT32 dataLength, BYTE* sig, UINT32 sigLength, UINT32 sectorType ) :
#if defined(ARM_V1_2)
#ifdef FEATURE_CPUCACHE
m_dataAddress( CPU_GetCachableAddress( dataAddress ) ),
#else
m_dataAddress(dataAddress),
#endif
#else
m_dataAddress( dataAddress ),
#endif
Expand Down Expand Up @@ -111,7 +115,7 @@ bool CryptoState::VerifySignature( UINT32 keyIndex )
}

// free RAM buffer
private_free(g_ConfigBuffer);
free(g_ConfigBuffer);
g_ConfigBuffer = NULL;

return fRet;
Expand Down
11 changes: 6 additions & 5 deletions Application/TinyBooter/TinyBooter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ extern bool WaitForTinyBooterUpload( INT32 &timeout_ms );

Loader_Engine g_eng;

//--//
// //--//

HAL_DECLARE_CUSTOM_HEAP( SimpleHeap_Allocate, SimpleHeap_Release, SimpleHeap_ReAllocate );
// HAL_DECLARE_CUSTOM_HEAP( SimpleHeap_Allocate, SimpleHeap_Release, SimpleHeap_ReAllocate );

//--//
// //--//

void ApplicationEntryPoint()
{
Expand All @@ -32,7 +32,6 @@ void ApplicationEntryPoint()
UINT32 SizeInBytes;

HeapLocation ( BaseAddress, SizeInBytes );
SimpleHeap_Initialize( BaseAddress, SizeInBytes );

g_eng.Initialize( HalSystemConfig.DebuggerPorts[ 0 ] );

Expand All @@ -55,8 +54,10 @@ void ApplicationEntryPoint()

if(enterBootMode)
{
#ifdef FEATURE_LCD
LCD_Clear();

#endif

hal_fprintf( STREAM_LCD, "TinyBooter v%d.%d.%d.%d\r\n", VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION);
hal_fprintf( STREAM_LCD, "%s Build Date:\r\n\t%s %s\r\n", HalName, __DATE__, __TIME__ );

Expand Down
Loading