реклама на сайте
подробности

 
 
> Динамическое выделение памяти в SDRAM, STM32F4
Atlantis-
сообщение Nov 19 2014, 12:52
Сообщение #1


Местный
***

Группа: Участник
Сообщений: 491
Регистрация: 18-05-11
Пользователь №: 65 102



Здравствуйте!
Можно ли динамически с помощью функции malloc() выделять память во внешней памяти SDRAM?
Go to the top of the page
 
+Quote Post
 
Start new topic
Ответов
Golikov A.
сообщение Nov 19 2014, 15:05
Сообщение #2


Гуру
******

Группа: Свой
Сообщений: 4 256
Регистрация: 17-02-06
Пользователь №: 14 454



вот выписка из их хелпа

Цитата
Creating the heap for use with microlib
ARM Compiler toolchain v5.02 for µVision Using ARM C and C++ Libraries and Floating-Point Support

Home > The ARM C micro-library > Creating the heap for use with microlib

Creating the heap for use with microlib
To use the heap functions, for example, malloc(), calloc(), realloc() and free(), you must specify the location and size of the heap region.

To specify the start and end of the heap you can use either of the following methods:

use a scatter file

define symbols __heap_base and __heap_limit.

The scatter file method uses ARM_LIB_HEAP and ARM_LIB_STACKHEAP.

Otherwise, specify the start and end of the heap by defining symbols __heap_base and __heap_limit respectively. On completion, you can use the heap functions in the normal way.

Note
The __heap_limit must point to the byte beyond the last byte in the heap region.

Example 17 shows how to set up the heap pointers using assembly language.

Example 17. Assembly language

EXPORT __heap_base
__heap_base EQU 0x400000 ; equal to the start of the heap
EXPORT __heap_limit
__heap_limit EQU 0x800000 ; equal to the end of the heap


Example 18 shows how to set up the heap pointer using embedded assembler in C.

Example 18. Embedded Assembler in C

__asm void dummy_function(void)
{
EXPORT __heap_base
__heap_base EQU 0x400000 ; equal to the start of the heap
EXPORT __heap_limit
__heap_limit EQU 0x800000 ; equal to the end of the heap
}





ну и задать heap в область DRAMа
Go to the top of the page
 
+Quote Post
Atlantis-
сообщение Nov 19 2014, 15:34
Сообщение #3


Местный
***

Группа: Участник
Сообщений: 491
Регистрация: 18-05-11
Пользователь №: 65 102



то есть startup файл не трогать, а после настройки SDRAM вызвать прямо в программе функцию со своими значениями heap_base и heap_limit?

Код
__asm void dummy_function(void)
{
EXPORT __heap_base
__heap_base EQU 0x400000; equal to the start of the heap
EXPORT __heap_limit
__heap_limit EQU 0x800000; equal to the end of the heap
}



Цитата(Golikov A. @ Nov 19 2014, 18:05) *
ну и задать heap в область DRAMа

что это значит?

а в настройках проекта во вкладке Target надо прописывать Memory Areas ?
Go to the top of the page
 
+Quote Post

Сообщений в этой теме
- Atlantis-   Динамическое выделение памяти в SDRAM   Nov 19 2014, 12:52
- - Golikov A.   можно если договоритесь с линкером там разместить ...   Nov 19 2014, 13:03
|- - Atlantis-   Цитата(Golikov A. @ Nov 19 2014, 16:03) м...   Nov 19 2014, 13:15
- - Golikov A.   вам надо сделать scater файл на закладе линкер ест...   Nov 19 2014, 15:55
- - Atlantis-   Если во вкладке Linker снять галочку Use Memory La...   Nov 20 2014, 07:31
- - Golikov A.   насколько я помню в стартап файле параметры кучи з...   Nov 20 2014, 07:47
- - Atlantis-   в стартапе вот что Код; <h> Heap Configura...   Nov 20 2014, 08:06
- - Golikov A.   ну то есть не победа. проверьте {} скобочки в ск...   Nov 20 2014, 08:49
|- - Atlantis-   Цитата(Golikov A. @ Nov 20 2014, 11:49) н...   Nov 20 2014, 09:54
- - Golikov A.   в хелпе было написано что в скатере надо определят...   Nov 20 2014, 12:33
|- - Atlantis-   Цитата(Golikov A. @ Nov 20 2014, 15:33) в...   Nov 20 2014, 13:17
- - Golikov A.   там написано что можно задать эти переменные в асм...   Nov 20 2014, 13:51
|- - Atlantis-   определил в стартапе Код;************************...   Nov 20 2014, 14:12
- - Golikov A.   Кодint *Pointer = 0; int A = 0; Pointer = malloc...   Nov 20 2014, 15:40
- - Atlantis-   адрес правильный возвращает, но при попытке инициа...   Nov 21 2014, 08:15
- - scifi   Цитата(Atlantis- @ Nov 21 2014, 11:1...   Nov 21 2014, 08:21
- - jcxz   Цитата(scifi @ Nov 21 2014, 14:21) Что-то...   Nov 21 2014, 08:39
- - Atlantis-   Цитата(scifi @ Nov 21 2014, 11:21) Что-то...   Nov 21 2014, 08:55


Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 23rd August 2025 - 14:23
Рейтинг@Mail.ru


Страница сгенерированна за 0.01394 секунд с 7
ELECTRONIX ©2004-2016