硬汉嵌入式论坛

 找回密码
 立即注册
查看: 284|回复: 0
收起左侧

[Embedded Studio] Embedded Studio使用calloc函数注意事项

[复制链接]

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107549
QQ
发表于 2023-9-9 01:55:06 | 显示全部楼层 |阅读模式



要在icf脚本里面加上这句才可以正常使用:

initialize by symbol __SEGGER_init_heap     { block heap  };

[C] 纯文本查看 复制代码
// **********************************************************************
// *                    SEGGER Microcontroller GmbH                     *
// *                        The Embedded Experts                        *
// **********************************************************************
// *                                                                    *
// *            (c) 2014 - 2019 SEGGER Microcontroller GmbH             *
// *            (c) 2001 - 2019 Rowley Associates Limited               *
// *                                                                    *
// *           [url]www.segger.com[/url]     Support: [email]support@segger.com[/email]           *
// *                                                                    *
// **********************************************************************
// *                                                                    *
// * All rights reserved.                                               *
// *                                                                    *
// * Redistribution and use in source and binary forms, with or         *
// * without modification, are permitted provided that the following    *
// * conditions are met:                                                *
// *                                                                    *
// * - Redistributions of source code must retain the above copyright   *
// *   notice, this list of conditions and the following disclaimer.    *
// *                                                                    *
// * - Neither the name of SEGGER Microcontroller GmbH                  *
// *   nor the names of its contributors may be used to endorse or      *
// *   promote products derived from this software without specific     *
// *   prior written permission.                                        *
// *                                                                    *
// * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND             *
// * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,        *
// * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF           *
// * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE           *
// * DISCLAIMED.                                                        *
// * IN NO EVENT SHALL SEGGER Microcontroller GmbH BE LIABLE FOR        *
// * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR           *
// * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT  *
// * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;    *
// * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF      *
// * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT          *
// * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE  *
// * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH   *
// * DAMAGE.                                                            *
// *                                                                    *
// **********************************************************************

define memory with size = 4G;

//
// Combined regions per memory type
//
define region FLASH = FLASH1;
define region RAM   = AXI_RAM1;

//
// Block definitions
//
define block vectors                        { section .vectors };
define block vectors_ram                    { section .vectors_ram };
define block ctors                          { section .ctors,     section .ctors.*, block with         alphabetical order { init_array } };
define block dtors                          { section .dtors,     section .dtors.*, block with reverse alphabetical order { fini_array } };
define block exidx                          { section .ARM.exidx, section .ARM.exidx.* };
define block tbss                           { section .tbss,      section .tbss.*  };
define block tdata                          { section .tdata,     section .tdata.* };
define block tls                            { block tbss, block tdata };
define block tdata_load                     { copy of block tdata };
define block heap  with size = __HEAPSIZE__,  alignment = 8, /* fill =0x00, */ readwrite access { };
define block stack with size = __STACKSIZE__, alignment = 8, /* fill =0xCD, */ readwrite access { };

//
// Explicit initialization settings for sections
//
do not initialize                           { section .non_init, section .non_init.*, section .*.non_init, section .*.non_init.* };
initialize by copy /* with packing=auto */  { section .data, section .data.*, section .*.data, section .*.data.* };
initialize by copy /* with packing=auto */  { section .fast, section .fast.* };

//
// Explicit placement in FLASHn
//
place in FLASH1                             { section .FLASH1, section .FLASH1.* };

//
// FLASH Placement
//
place at start of FLASH                     { block vectors };                         // Vector table section
place in FLASH with minimum size order      { section .init,   section .init.*,        // Init code section
                                              section .init_rodata, section .init_rodata.*, // Init read-only section
                                              section .text,   section .text.*,        // Code section
                                              section .rodata, section .rodata.*,      // Read-only data section
                                              section .segger.*,                       // Auto-generated initialization
                                              block exidx,                             // ARM exception unwinding block
                                              block ctors,                             // Constructors block
                                              block dtors };                           // Destructors block
place in FLASH                              { block tdata_load };                      // Thread-local-storage load image


//
// Explicit placement in RAMn
//
place in ITCM_RAM1                          { section .ITCM_RAM1, section .ITCM_RAM1.* };
place in DTCM_RAM1                          { section .DTCM_RAM1, section .DTCM_RAM1.* };
place in AXI_RAM1                           { section .AXI_RAM1, section .AXI_RAM1.* };
place in RAM1                               { section .RAM1, section .RAM1.* };
place in RAM2                               { section .RAM2, section .RAM2.* };
place in RAM3                               { section .RAM3, section .RAM3.* };
place in RAM4                               { section .RAM4, section .RAM4.* };
place in Backup_RAM1                        { section .Backup_RAM1, section .Backup_RAM1.* };

//
// RAM Placement
//
place at start of RAM                       { block vectors_ram };
place in RAM                                { section .non_init, section .non_init.*,  // No initialization section
                                              block tls };                             // Thread-local-storage block
place in RAM with auto order                { section .fast, section .fast.*,          // "ramfunc" section
                                              section .data, section .data.*,          // Initialized data section
                                              section .bss, section .bss.*
                                            };          // Static data section
place in RAM                                { block heap };           // Heap reserved block
place at end of RAM                         { block stack };          // Stack reserved block at the end

initialize by symbol __SEGGER_init_heap     { block heap  }; 

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-6-5 13:43 , Processed in 0.143719 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表