Цитата(scifi @ Nov 21 2014, 11:21)

Что-то я не пойму, выход за границу массива - это так и задумано? Или вы просто не в курсе, что элемент с номером 2050000 - это байт с номером 8200000?
не в курсе. теперь разобрался. из-за того что *p у меня uint32_t выделяется по 4 байта а не по одному
по теме - вот что на форуме my.st посоветовали по настройке heap
CODE
// STM32 Keil SDRAM HEAP STM32F429I-DISCO - sourcer32@gmail.com
// Use MicroLIB checked in options
// Use Scatter file in Linker options (not Memory Layout from Target Dialog)
/* heap.sct
LR_IROM1 0x08000000 0x00200000 { ; load region size_region
ER_IROM1 0x08000000 0x00200000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
RW_IRAM1 0x20000000 0x00030000 { ; Internal SRAM
.ANY (+RW +ZI)
}
RW_IRAM2 0x10000000 UNINIT 0x00010000 { ; Internal CCM SRAM
*(.ccm)
}
RW_RAM1 0xD0000000 UNINIT 0x00800000 { ; External SDRAM
*(HEAP)
}
}
*/
/* startup_stm32f429_439xx.s
...
Heap_Size EQU 0x00800000
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem SPACE Heap_Size
__heap_limit
...
*/
#include <stdio.h>
#include <stdlib.h>
#include "stm32f429i_discovery.h"
#include "stm32f429i_discovery_sdram.h"
/********************************************************************************
******/
int main(void)
{
char *p;
/* Make sure to initialize the external memory, pins and buses before using them */
/* SDRAM Initialization */
SDRAM_Init();
/* Disable write protection */
FMC_SDRAMWriteProtectionConfig(FMC_Bank2_SDRAM,DISABLE);
p = malloc(0x1000);
printf("Allocation at %p\n", p);
free(p);
while(1); // Don't want to exit
}
//******************************************************************************
// Hosting of stdio functionality through SWV - Serial Wire Viewer
//******************************************************************************
#include <rt_misc.h>
#pragma import(__use_no_semihosting_swi)
struct __FILE { int handle; /* Add whatever you need here */ };
FILE __stdout;
FILE __stdin;
int fputc(int ch, FILE *f)
{
ITM_SendChar(ch);
return(ch);
}
int fgetc(FILE *f)
{
char ch;
ch = '?';
return((int)ch);
}
int ferror(FILE *f)
{
/* Your implementation of ferror */
return EOF;
}
void _ttywrch(int ch)
{
ITM_SendChar(ch);
}
void _sys_exit(int return_code)
{
label: goto label; /* endless loop */
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
while (1)
{
}
}
#endif
Сейчас вроде все работает. Большое спасибо
Golikov A. за помощь!