mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #5189 from 0xc0170/fix_lpc1768_iarramend
LPC1768: RAM end adjust fixpull/5202/head
commit
3759d03fa1
|
@ -9,7 +9,7 @@ define symbol __ICFEDIT_region_ROM_end__ = 0x0007FFFF;
|
|||
define symbol __ICFEDIT_region_NVIC_start__ = 0x10000000;
|
||||
define symbol __ICFEDIT_region_NVIC_end__ = 0x100000C7;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x100000C8;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x10007FDF;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x10007FE0;
|
||||
|
||||
/*-Sizes-*/
|
||||
/*Heap 1/4 of ram and stack 1/8*/
|
||||
|
|
|
@ -85,6 +85,7 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)
|
|||
|
||||
n = GetSecNum(address); // Get Sector Number
|
||||
|
||||
core_util_critical_section_enter();
|
||||
IAP.cmd = 50;// Prepare Sector for Erase
|
||||
IAP.par[0] = n;// Start Sector
|
||||
IAP.par[1] = n;// End Sector
|
||||
|
@ -98,6 +99,7 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)
|
|||
IAP.par[1] = n;// End Sector
|
||||
IAP.par[2] = CCLK;// CCLK in kHz
|
||||
IAP_Call (&IAP.cmd, &IAP.stat);// Call IAP Command
|
||||
core_util_critical_section_exit();
|
||||
if (IAP.stat) {
|
||||
return (1); // Command Failed
|
||||
}
|
||||
|
@ -106,18 +108,16 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)
|
|||
|
||||
}
|
||||
|
||||
/* IAP Call */
|
||||
typedef void (*IAP_Entry) (unsigned long *cmd, unsigned long *stat);
|
||||
#define IAP_Call ((IAP_Entry) 0x1FFF1FF1)
|
||||
|
||||
int32_t flash_program_page(flash_t *obj, uint32_t address,
|
||||
const uint8_t *data, uint32_t size)
|
||||
{
|
||||
unsigned long n;
|
||||
uint8_t *alignedData = 0;
|
||||
// always malloc outside critical section
|
||||
uint8_t *alignedData = malloc(size);
|
||||
|
||||
n = GetSecNum(address); // Get Sector Number
|
||||
|
||||
core_util_critical_section_enter();
|
||||
IAP.cmd = 50;// Prepare Sector for Write
|
||||
IAP.par[0] = n;// Start Sector
|
||||
IAP.par[1] = n;// End Sector
|
||||
|
@ -132,7 +132,6 @@ int32_t flash_program_page(flash_t *obj, uint32_t address,
|
|||
if ((unsigned long)data%4==0) { // Word boundary
|
||||
IAP.par[1] = (unsigned long)data;// Source RAM Address
|
||||
} else {
|
||||
alignedData = malloc(size);
|
||||
memcpy(alignedData,data,size);
|
||||
IAP.par[1] = (unsigned long)alignedData; // Source RAM Address
|
||||
}
|
||||
|
@ -140,6 +139,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address,
|
|||
IAP.par[2] = 1024; // Fixed Page Size
|
||||
IAP.par[3] = CCLK;// CCLK in kHz
|
||||
IAP_Call (&IAP.cmd, &IAP.stat);// Call IAP Command
|
||||
core_util_critical_section_exit();
|
||||
|
||||
if(alignedData !=0) { // We allocated our own memory
|
||||
free(alignedData);
|
||||
|
|
Loading…
Reference in New Issue