内核编译不能找到standby.code错误解决办法

一 说明

使用全志(Allwinner )A20处理器,为其单独编译内核时,首次编译有时会遇到以下错误:

arch/arm/mach-sun7i/pm/standby.S:3: Error: file not found: arch/arm/mach-sun7i/pm/standby/standby.code

如下图所示:
这里写图片描述
其实不仅仅是该问题,还有以下几个错误:

arch/arm/mach-sun7i/pm/mem.S:3: Error: file not found: arch/arm/mach-sun7i/pm/standby/super/suspend/suspend.code

arch/arm/mach-sun7i/pm/mem.S:9: Error: file not found: arch/arm/mach-sun7i/pm/standby/super/resume/resume0.code

这两个问题其实和第一个问题是一个问题,第一个问题解决了这两个问题也会同时解决。

二 错误造成原因

该问题是在linux内核3.3版本中遇到的,并且是在全志官方提供的SDK(A20_SDK_20130319.tar.gz)中遇到的,用SDK中的脚本编译时有该问题,单独编译其中的内核(不使用SDK中的脚本,直接使用make编译内核源码)时也会遇到该问题,该问题只在第一次编译时出现,之后编译不会有该问题,如果distclean后编译可能会再遇到(未测试),遇到后的处理方法是一样的。
造成该问题的原因是arch/arm/mach-sun7i/pm/standby目录下的文件没有编译,至于为什么没有编译和之前怎么没有该问题等,在此处不讨论(关键是本人没有深入研究,也不知道原因),此处只说明遇到该问题后的解决办法。

三 解决办法

解决办法很简单,就是手动编译standby就好了。
此处需要注意的是,如果编译内核时的输出文件并非内核目录而是其他目录(make时使用了O参数,如make uImage O=/tmp/build),需要多做一些处理,这种情况在后边介绍。
打开standby目录下的Makefile,发现有两个变量KDIR和CROSS_COMPILE,由于该模块是单独手动编译,所以它不能从上层模块继承该变量,需要make时传进去。

#makefile for standby.bin

INCLUDE   = -I. \
        -I$(KDIR)/include \
        -I$(KDIR)/arch/arm/mach-sun7i/include \
... ...
CC = $(CROSS_COMPILE)gcc

知道需要的参数后就开始编译该模块:

#进入内核目录
$cd /home/linux/ex/linux-3.3/
#进入standby模块目录
$cd arch/arm/mach-sun7i/pm/standby
#编译模块
$make KDIR=/home/linux/ex/linux-3.3 CROSS_COMPILE=arm-linux-gnueabi-

此时就开始编译,编译过程中会有恨到打印信息,其中会出现以下4个信息:
这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

到此,模块编译完成,可以继续编译内核了。

上边提到编译内核时的输出文件并非内核目录而是其他目录,此时需要多两个操作:

  1. 修改该模块的Makefile
  2. 拷贝生成的.code文件到输出文件的对应目录

1)该模块编译时依赖内核配置时产生的include/generated下的头文件,所以需要将输出文件下的include路径添加到Makefile的INCLUDE变量中,添加后的Makefile如下:

#makefile for standby.bin

INCLUDE   = -I. \
        -I$(KDIR)/include \
        -I$(KDIR)/arch/arm/mach-sun7i/include \
        -I/tmp/build/include \

在Makefile中添加了-I/tmp/build/include \,其中/tmp/build是编译内核时的文件输出路径(make时的参数O的值)。
2)编译后要将生成的standby.code、suspend.code、resume0.code及resume1.code分别拷贝到编译目录(如/tmp/build)下的对应位置:

/tmp/build/arch/arm/mach-sun7i/pm/standby/
/tmp/build/arch/arm/mach-sun7i/pm/standby/suspend/
/tmp/build/arch/arm/mach-sun7i/pm/standby/resume/

到此,该问题解决。

NXP S32K314EHT1VPBST freeRTOS系统 Flash 为4Mb 计算剩余FLash linker_flash_s32k314.ld 如下 /*================================================================================================== * Project : RTD AUTOSAR 4.4 * Platform : CORTEXM * Peripheral : * Dependencies : none * * Autosar Version : 4.4.0 * Autosar Revision : ASR_REL_4_4_REV_0000 * Autosar Conf.Variant : * SW Version : 2.0.1 * Build Version : S32K3_RTD_2_0_1_D2207_ASR_REL_4_4_REV_0000_20220707 * * (c) Copyright 2020 - 2022 NXP Semiconductors * 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. ==================================================================================================*/ /* * GCC Linker Command File: * 0x00400000 0x007FFFFF 4194304 Program Flash (last 64K sBAF) * 0x10000000 0x1003FFFF 262144 Data Flash (last 32K HSE_NVM) * 0x20400000 0x20408000 32768 Standby RAM_0 (32K) * 0x20400000 0x20427FFF 163840 SRAM_0 * 0x20428000 0x2044FFFF 163840 SRAM_1 * Last 48 KB of SRAM_1 reserved by HSE Firmware * Last 176 KB of CODE_FLASH_3 reserved by HSE Firmware * Last 128 KB of DATA_FLASH reserved by HSE Firmware (not supported in this linker file) */ HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x00002000; APP_START_ADDR = DEFINED(g_iVersionUsedAsAPPB) ? 0x00600000 : 0x00480000; ENTRY(Reset_Handler) MEMORY { int_flash : ORIGIN = APP_START_ADDR, LENGTH = 0x00180000 /* A: 0x00480000;B: 0x00600000*//* (4096K - 176K (sBAF + HSE) - 512K(Boot))/2 */ int_itcm : ORIGIN = 0x00000000, LENGTH = 0x00008000 /* 32K */ int_dtcm : ORIGIN = 0x20000000, LENGTH = 0x00010000- 0x1000 /* 64K - 0x1000*/ int_stack_dtcm : ORIGIN = 0x20010000-0x1000, LENGTH = 0x1000 /*Set last 4KB DTCM as stack*/ int_standbysram : ORIGIN = 0x20400000, LENGTH = 0x00000400 /* 1K 20230306,by lhc for pwrctl */ int_standbysram_stack : ORIGIN = 0x20400400, LENGTH = 0x00000400 /* 1K 20230306,by lhc for pwrctl */ int_sram : ORIGIN = 0x20400800, LENGTH = 0x0002D700 /* 181.9K 20230306,by lhc for pwrctl */ int_sram_fls_rsv : ORIGIN = 0x2042DF00, LENGTH = 0x00000100 /* 0.1K */ int_sram_stack_c0 : ORIGIN = 0x2042E000, LENGTH = 0x00001000 /* 4KB */ int_sram_stack_c1 : ORIGIN = 0x2042F000, LENGTH = 0x00001000 /* 4KB */ int_sram_no_cacheable : ORIGIN = 0x20430000, LENGTH = 0x0000FF00 /* 64KB, needs to include int_results */ int_sram_results : ORIGIN = 0x2043FF00, LENGTH = 0x00000100 int_sram_shareable : ORIGIN = 0x20440000, LENGTH = 0x00004000 /* 16KB */ ram_rsvd2 : ORIGIN = 0x20444000, LENGTH = 0 /* End of SRAM */ } SECTIONS { .flash : { KEEP(*(.boot_header)) . = ALIGN(2048); KEEP(*(.ys_firmware_version)) . = ALIGN(1024); LONG(0x5A5A5A5A) /* 文件信息标识1 */ LONG(0xA5A5A5A5) /* 文件信息标识2 */ LONG(0xFFFFFFFF) /* 固件长度 */ LONG(0xFFFFFFFF) /* 固件校验值 */ LONG(0xFFFFFFFF) /* 预留1 */ LONG(0xFFFFFFFF) /* 预留2 */ LONG(0xFFFFFFFF) /* 预留3 */ LONG(0xFFFFFFFF) /* 预留4 */ . = ALIGN(2048); __text_start = .; __interrupts_rom_start = .; KEEP(*(.intc_vector)) . = ALIGN(4); __interrupts_rom_end = .; . = ALIGN(128); __fast_wkup_boot_vector_start = .; KEEP(*(.fast_wkup_boot_vector)) KEEP(*(.core_loop)) . = ALIGN(4); *(.startup) . = ALIGN(4); *(.systeminit) . = ALIGN(4); *(.text.startup) . = ALIGN(4); *(.text) *(.text*) . = ALIGN(4); *(.mcal_text) . = ALIGN(4); *(.acmcu_code_rom) . = ALIGN(4); __acfls_code_rom_start = .; *(.acfls_code_rom) . = ALIGN(4); __acfls_code_rom_end = .; KEEP(*(.init)) . = ALIGN(4); KEEP(*(.fini)) . = ALIGN(4); *(.rodata) *(.rodata*) . = ALIGN(4); *(.mcal_const_cfg) . = ALIGN(4); *(.mcal_const) . = ALIGN(4); __standby_init_table = .; /* 20230306,by lhc for pwrctl */ KEEP(*(.standby_init_table)) . = ALIGN(4); __init_table = .; KEEP(*(.init_table)) . = ALIGN(4); __zero_table = .; KEEP(*(.zero_table)) } > int_flash . = ALIGN(4); __text_end = .; __standby_sram_data_rom_start = __text_end; .standby_sram_data : AT(__standby_sram_data_rom_start)/* 20230306,by lhc for pwrctl */ { . = ALIGN(4); __standby_sram_data_begin__ = .; *(.m_interrupt_ram) *(.m_interrupt_code_ram) . = ALIGN(4); __standby_sram_data_end__ = .; } > int_standbysram . = ALIGN(4); /* 20230306,by lhc for pwrctl */ __standby_sram_data_rom_end = __standby_sram_data_rom_start + (__standby_sram_data_end__ - __standby_sram_data_begin__); __sram_data_rom = __standby_sram_data_rom_end; .sram_data : AT(__sram_data_rom) { . = ALIGN(4); __sram_data_begin__ = .; . = ALIGN(4); *(.ramcode) . = ALIGN(4); *(.data) *(.data*) . = ALIGN(4); *(.mcal_data) . = ALIGN(4); __sram_data_end__ = .; } > int_sram __sram_data_rom_end = __sram_data_rom + (__sram_data_end__ - __sram_data_begin__); .sram_bss (NOLOAD) : { . = ALIGN(16); __sram_bss_start = .; *(.bss) *(.bss*) . = ALIGN(16); *(.mcal_bss) . = ALIGN(4); __sram_bss_end = .; } > int_sram /* heap section */ .heap (NOLOAD): { . += ALIGN(4); _end = .; end = .; _heap_start = .; . += HEAP_SIZE; _heap_end = .; } > int_sram .ARM.exidx : { *(.ARM.exidx*) *(.gnu.linkonce.armexidx.*) } > int_sram .acfls_code_ram : { acfls_code_ram_start = .; *(.acfls_code_ram) acfls_code_ram_stop = .; } > int_sram_fls_rsv __non_cacheable_data_rom = __sram_data_rom_end; .non_cacheable_data : AT(__non_cacheable_data_rom) { . = ALIGN(4); __non_cacheable_data_start__ = .; /* the vector table start */ . = ALIGN(4096); __interrupts_ram_start = .; . += __interrupts_rom_end - __interrupts_rom_start; . = ALIGN(4); __interrupts_ram_end = .; /* the vector table end */ . = ALIGN(4); *(.mcal_data_no_cacheable) . = ALIGN(4); *(.mcal_const_no_cacheable) . = ALIGN(4); HSE_LOOP_ADDR = .; LONG(0x0); __non_cacheable_data_end__ = .; } > int_sram_no_cacheable int_results (NOLOAD): { . = ALIGN(4); KEEP(*(.int_results)) . += 0x100; } > int_sram_results __non_cacheable_data_rom_end = __non_cacheable_data_rom + (__non_cacheable_data_end__ - __non_cacheable_data_start__); .non_cacheable_bss (NOLOAD) : { . = ALIGN(16); __non_cacheable_bss_start = .; *(.mcal_bss_no_cacheable) . = ALIGN(4); __non_cacheable_bss_end = .; } > int_sram_no_cacheable __shareable_data_rom = __non_cacheable_data_rom_end; .shareable_data : AT(__shareable_data_rom) { . = ALIGN(4); __shareable_data_start__ = .; KEEP(*(.mcal_shared_data)) . = ALIGN(4); __shareable_data_end__ = .; } > int_sram_shareable __shareable_data_rom_end = __shareable_data_rom + (__shareable_data_end__ - __shareable_data_start__); .shareable_bss (NOLOAD) : { . = ALIGN(16); __shareable_bss_start = .; *(.mcal_shared_bss) . = ALIGN(4); __shareable_bss_end = .; } > int_sram_shareable __Standby_Stack_end = ORIGIN(int_standbysram_stack); /* 20230306,by lhc for pwrctl */ __itcm_rom = __shareable_data_rom_end; .itcm : AT(__itcm_rom) { . = ALIGN(4); __itcm_start = .; *(.itcm_code) . = ALIGN(4); __itcm_end = .; } > int_itcm __itcm_rom_end = __itcm_rom + (__itcm_end - __itcm_start); __dtcm_rom = __itcm_rom_end; .dtcm_data : AT(__dtcm_rom) { . = ALIGN(4); __dtcm_data_start = .; /* the vector table start */ /* . = ALIGN(4096); */ /* __interrupts_ram_start = .; */ /* . += __interrupts_rom_end - __interrupts_rom_start; */ /* . = ALIGN(4); */ /* __interrupts_ram_end = .; */ /* the vector table end */ . = ALIGN(4); *(.dtcm_data) . = ALIGN(4); __dtcm_data_end = .; } > int_dtcm __dtcm_rom_end = __dtcm_rom + (__dtcm_data_end - __dtcm_data_start); .dtcm_bss (NOLOAD) : { . = ALIGN(4); __dtcm_bss_start = .; *(.dtcm_bss) . = ALIGN(4); __dtcm_bss_end = .; } > int_dtcm __Standby_Stack_start = ORIGIN(int_standbysram_stack) + LENGTH(int_standbysram_stack); /* 20230306,by lhc for pwrctl */ __Stack_end_c0 = ORIGIN(int_stack_dtcm); __Stack_start_c0 = ORIGIN(int_stack_dtcm) + LENGTH(int_stack_dtcm); __Stack_end_c1 = ORIGIN(int_sram_stack_c1); __Stack_start_c1 = ORIGIN(int_sram_stack_c1) + LENGTH(int_sram_stack_c1); __INT_SRAM_START = ORIGIN(int_sram); __INT_SRAM_END = ORIGIN(ram_rsvd2); __INT_ITCM_START = ORIGIN(int_itcm); __INT_ITCM_END = ORIGIN(int_itcm) + LENGTH(int_itcm); __INT_DTCM_START = ORIGIN(int_dtcm); __INT_DTCM_END = ORIGIN(int_dtcm) + LENGTH(int_dtcm) + LENGTH(int_stack_dtcm); __STANDBY_SRAM_START = ORIGIN(int_standbysram); /* 20230306,by lhc for pwrctl */ __STANDBY_ROM_START = __standby_sram_data_rom_start; /* 20230306,by lhc for pwrctl */ __STANDBY_ROM_END = __standby_sram_data_rom_end; /* 20230306,by lhc for pwrctl */ __STANDBY_SRAM_END = __standby_sram_data_end__; /* 20230306,by lhc for pwrctl */ __STANDBY_SRAM_SIZE = LENGTH(int_standbysram) + LENGTH(int_standbysram_stack); __RAM_SHAREABLE_START = ORIGIN(int_sram_shareable); __RAM_SHAREABLE_END = ORIGIN(ram_rsvd2)-1; __RAM_SHAREABLE_SIZE = 0xE; /*16 kbyte*/ __ROM_SHAREABLE_START = __shareable_data_rom; __ROM_SHAREABLE_END = __shareable_data_rom_end; __RAM_NO_CACHEABLE_START = ORIGIN(int_sram_no_cacheable); __RAM_NO_CACHEABLE_END = ORIGIN(int_sram_shareable)-1; __RAM_NO_CACHEABLE_SIZE = 0x10; /* 64kbyte in power of 2 */ __ROM_NO_CACHEABLE_START = __non_cacheable_data_rom; __ROM_NO_CACHEABLE_END = __non_cacheable_data_rom_end; __RAM_CACHEABLE_START = ORIGIN(int_sram); __RAM_CACHEABLE_END = ORIGIN(int_sram_no_cacheable)-1; __RAM_CACHEABLE_SIZE = 0x12; /* 256kbyte in power of 2 */ __ROM_CACHEABLE_START = __sram_data_rom; __ROM_CACHEABLE_END = __sram_data_rom_end; __ROM_CODE_START = ORIGIN(int_flash); __ROM_CODE_SIZE = LENGTH(int_flash); __ROM_DATA_START = 0x10000000; __RAM_ITCM_START = __itcm_start; __ROM_ITCM_START = __itcm_rom; __ROM_ITCM_END = __itcm_rom_end; __RAM_DTCM_START = __dtcm_data_start; __ROM_DTCM_START = __dtcm_rom; __ROM_DTCM_END = __dtcm_rom_end; __BSS_DTCM_START = __dtcm_bss_start; __BSS_DTCM_END = __dtcm_bss_end; __BSS_DTCM_SIZE = __dtcm_bss_end - __dtcm_bss_start; __BSS_SRAM_START = __sram_bss_start; __BSS_SRAM_END = __sram_bss_end; __BSS_SRAM_SIZE = __sram_bss_end - __sram_bss_start; __BSS_SRAM_NC_START = __non_cacheable_bss_start; __BSS_SRAM_NC_SIZE = __non_cacheable_bss_end - __non_cacheable_bss_start; __BSS_SRAM_NC_END = __non_cacheable_bss_end; __BSS_SRAM_SH_START = __shareable_bss_start; __BSS_SRAM_SH_SIZE = __shareable_bss_end - __shareable_bss_start; __BSS_SRAM_SH_END = __shareable_bss_end; __RAM_INTERRUPT_START = __interrupts_ram_start; __ROM_INTERRUPT_START = __interrupts_rom_start; __ROM_INTERRUPT_END = __interrupts_rom_end; __STANDBY_INIT_TABLE = __standby_init_table; /* 20230306,by lhc for pwrctl */ __INIT_TABLE = __init_table; __ZERO_TABLE = __zero_table; __RAM_INIT = 1; __ITCM_INIT = 1; __DTCM_INIT = 1; Fls_ACEraseRomStart = __acfls_code_rom_start; Fls_ACEraseRomEnd = __acfls_code_rom_end; Fls_ACEraseSize = (__acfls_code_rom_end - __acfls_code_rom_start) / 4; /* Copy 4 bytes at a time*/ Fls_ACWriteRomStart = __acfls_code_rom_start; Fls_ACWriteRomEnd = __acfls_code_rom_end; Fls_ACWriteSize = (__acfls_code_rom_end - __acfls_code_rom_start) / 4; /* Copy 4 bytes at a time*/ _ERASE_FUNC_ADDRESS_ = ADDR(.acfls_code_ram); _WRITE_FUNC_ADDRESS_ = ADDR(.acfls_code_ram); __ENTRY_VTABLE = __ROM_INTERRUPT_START; __CORE0_VTOR = __interrupts_rom_start; __CORE1_VTOR = __interrupts_rom_start; _sstack = __Stack_start_c1; _estack = __Stack_end_c0; _stext = __ROM_CODE_START; _etext = __ROM_CODE_START + __ROM_CODE_SIZE; }
最新发布
11-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值