AC6下编译NXP S32K146报错
最近在使用S32K146芯片,移植过程遇到些问题。开发环境:KEILV5.36 + AC6。 1. 需要自行定义__CLANG_ARM这个宏? S32K146仅支持AC6编译器。但从AC6的用户手册上查不到有预定义__CLANG_ARM这个宏,而是定义了__GNUC__这个宏。AC6本身是兼容GCC语法的。 我不太清楚这个宏是从哪来的?是否需要自行定义?
2. 自行添加__CLANG_ARM后,编译报错,这个需要怎么改动? 我的修改: /* C stack block name, default is STACK */ #define CMB_CSTACK_BLOCK_NAME ARM_LIB_STACK
/* code section name, default is ER_IROM1 */ #define CMB_CODE_SECTION_NAME m_text 报错: .\app.axf: Error: L6218E: Undefined symbol Image$$m_text$$Limit (referred from cm_backtrace.o).
SCT文件见附件。 Uploading S32K146_128_flash.sct…
#! armclang --target=arm-arm-none-eabi -mcpu=cortex-m4 -xc -E /*
- modified by ARM
- If flash_vector_table is defined then interrupt vector table is not copied to RAM.
- If flash_vector_table is defined at link time then it must also be defined for
- assembling startup_14*.s / / ** ################################################################### ** Processor: S32K146 with 128 KB SRAM ** Compiler: ARM Compiler ** ** Abstract: ** Linker file for the ARM Compiler ** ** Copyright (c) 2015-2016 Freescale Semiconductor, Inc. ** Copyright 2017 NXP ** All rights reserved. ** ** NXP Confidential. This software is owned or controlled by NXP and may only be ** used strictly in accordance with the applicable license terms. By expressly ** accepting such terms or by downloading, installing, activating and/or otherwise ** using the software, you are agreeing that you have read, and that you agree to ** comply with and are bound by, such license terms. If you do not agree to be ** bound by the applicable license terms, then you may not retain, install, ** activate or otherwise use the software. The production use license in ** Section 2.3 is expressly granted for this software. ** ** http: www.nxp.com ** ** ################################################################### */
#if (defined(flash_vector_table)) #define ram_vector_table_size 0x00000000 #else #define ram_vector_table_size 0x00000400 #endif
#define m_interrupts_start 0x00000000 #define m_interrupts_size 0x00000400
#define m_flash_config_start 0x00000400 #define m_flash_config_size 0x00000010
#define m_text_start 0x00000410 #define m_text_size 0x000FFBF0
#define m_interrupts_ram_start 0x1FFF0000 #define m_interrupts_ram_size ram_vector_table_size
#define m_data_start 0x1FFF0000 + ram_vector_table_size #define m_data_size 0x00010000 - ram_vector_table_size
#define m_data_2_start 0x20000000 #define m_data_2_size 0x0000F000
/* Sizes */ #if (defined(stack_size)) #define Stack_Size stack_size #else #define Stack_Size 0x0400 #endif
#if (defined(heap_size)) #define Heap_Size heap_size #else #define Heap_Size 0x0400 #endif
LR_m_text m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; load region size_region VECTOR_ROM m_interrupts_start m_interrupts_size { ; load address = execution address startup_S32K1*.o (RESET +First) }
#if (defined(flash_vector_table)) VECTOR_RAM m_interrupts_start EMPTY 0 { } #else VECTOR_RAM m_interrupts_ram_start EMPTY m_interrupts_ram_size { } #endif
ER_m_flash_config m_flash_config_start FIXED m_flash_config_size { ; load address = execution address * (FlashConfig) }
ER_m_text_const m_text_start { ; load address = execution address .ANY (+RO-DATA) }
ER_m_text +0 m_text_size { ; load address = execution address * (InRoot$$Sections) .ANY (+RO) }
RW_m_data m_data_start { ; RW data .ANY (+RW-DATA) }
RW_m_code +0 m_data_size { ; RW data .ANY (.code_ram) }
/* Custom Section Block that can be used to place data at absolute address. / / Use attribute((section (".customSection"))) to place data here. / RW_m_custom_section m_data_2_start ALIGN 0x4 { .ANY (.customSection) / Keep section even if not referenced. */ }
RW_m_data_2 +0 m_data_2_size-Stack_Size-Heap_Size { ; RW data .ANY (+ZI) }
ARM_LIB_HEAP ((ImageLimit(RW_m_data_2) == m_data_2_start) ? m_data_2_start : +0) EMPTY Heap_Size { ; Heap region growing up }
ARM_LIB_STACK m_data_2_start+m_data_2_size EMPTY -Stack_Size { ; Stack region growing down } }