// *INDENT-OFF* #include "app_config.h" /* ================= BR25 SDK memory ======================== _______________ ___ 0x32000(136K) | isr base | |_______________|___ _IRQ_MEM_ADDR(size = 0x100) |rom export ram | |_______________| | update | |_______________|___ RAM_LIMIT_H | HEAP | |_______________|___ data_code_pc_limit_H | audio overlay | |_______________| | data_code | |_______________|___ data_code_pc_limit_L | bss | |_______________| | data | |_______________| | irq_stack | |_______________| | boot info | |_______________| | TLB | |_______________|0x10000 RAM_LIMIT_L | Reserved | |_______________|0 =========================================================== */ #include "maskrom_stubs.ld" EXTERN( _start #include "sdk_used_list.c" ); UPDATA_SIZE = 0x80; UPDATA_BEG = _MASK_MEM_BEGIN - UPDATA_SIZE; UPDATA_BREDR_BASE_BEG = 0xf9000; //depend on loader code & data RAM_LIMIT_L = 0x10000; RAM_LIMIT_H = UPDATA_BEG; PHY_RAM_SIZE = RAM_LIMIT_H - RAM_LIMIT_L; //from mask export ISR_BASE = _IRQ_MEM_ADDR; ROM_RAM_SIZE = _MASK_MEM_SIZE; ROM_RAM_BEG = _MASK_MEM_BEGIN; RAM_BEGIN = RAM_LIMIT_L; RAM_END = RAM_LIMIT_H; RAM_SIZE = RAM_END - RAM_BEGIN; #if MIC_EFFECT_EQ_EN MIC_EFFECT_EQ_SECTION = 8; #else MIC_EFFECT_EQ_SECTION = 3; #endif #if (EQ_SECTION_MAX > 10) EQ_SECTION_NUM = EQ_SECTION_MAX+MIC_EFFECT_EQ_SECTION; #else EQ_SECTION_NUM = 10+MIC_EFFECT_EQ_SECTION; #endif //=============== About BT RAM =================== //CONFIG_BT_RX_BUFF_SIZE = (1024 * 18); MEMORY { #if ((defined CONFIG_NEW_CFG_TOOL_ENABLE) && (defined CONFIG_SOUNDBOX)) code0(rx) : ORIGIN = 0x1E00100, LENGTH = CONFIG_FLASH_SIZE #else code0(rx) : ORIGIN = 0x1E00120, LENGTH = CONFIG_FLASH_SIZE #endif ram0(rwx) : ORIGIN = RAM_BEGIN, LENGTH = RAM_SIZE } ENTRY(_start) EXTERN(lib_update_version) SECTIONS { . = ORIGIN(code0); .text ALIGN(4): { PROVIDE(flash_code_begin = .); *(.startup.text) bank_stub_start = .; *(.bank.stub.*) bank_stub_size = . - bank_stub_start; . = ALIGN(4); *(.dts_dec_const) *(.dts_const) *(.dts_dec_code) *(.dts_code) *(.dts_dec_sparse_code) *(.dts_dec_sparse_const) *(.dts_dec_ff_const) . = ALIGN(4); *(.m4a_const) *(.m4a_code) *(.m4a_dec_const) *(.m4a_dec_code) *(.m4a_dec_sparse_code) *(.m4a_dec_sparse_const) *(.m4a_dec_ff_const) . = ALIGN(4); *(.aac_const) *(.aac_code) *(.bt_aac_dec_eng_const) *(.bt_aac_dec_eng_code) *(.bt_aac_dec_core_code) *(.bt_aac_dec_core_sparse_code) . = ALIGN(4); *(.alac_const) *(.alac_code) . = ALIGN(4); // must at tail, make rom_code size align 4 clock_critical_handler_begin = .; KEEP(*(.clock_critical_txt)) clock_critical_handler_end = .; . = ALIGN(4); gsensor_dev_begin = .; KEEP(*(.gsensor_dev)) gsensor_dev_end = .; //mouse sensor dev begin . = ALIGN(4); OMSensor_dev_begin = .; KEEP(*(.omsensor_dev)) OMSensor_dev_end = .; . = ALIGN(4); fm_dev_begin = .; KEEP(*(.fm_dev)) fm_dev_end = .; . = ALIGN(4); fm_emitter_dev_begin = .; KEEP(*(.fm_emitter_dev)) fm_emitter_dev_end = .; . = ALIGN(4); tool_interface_begin = .; KEEP(*(.tool_interface)) tool_interface_end = .; . = ALIGN(4); cmd_interface_begin = .; KEEP(*(.eff_cmd)) cmd_interface_end = .; . = ALIGN(4); . = ALIGN(4); adapter_idev_begin = .; KEEP(*(.adapter_idev)) adapter_idev_end = .; . = ALIGN(4); adapter_odev_begin = .; KEEP(*(.adapter_odev)) adapter_odev_end = .; . = ALIGN(4); adapter_enc_begin = .; KEEP(*(.adapter_enc)) adapter_enc_end = .; . = ALIGN(4); adapter_decoder_begin = .; KEEP(*(.adapter_decoder)) adapter_decoder_end = .; . = ALIGN(4); adapter_encoder_begin = .; KEEP(*(.adapter_encoder)) adapter_encoder_end = .; #if (!TCFG_CODE_RUN_RAM_FM_MODE) *(.usr_timer_const) *(.timer_const) *(.cbuf_const) *(.fm_data_const) . = ALIGN(4); #endif *(.usr_timer_code) *(.timer_code) *(.cbuf_code) *(.fm_data_code) . = ALIGN(4); /* . = ALIGN(4); */ /* storage_device_begin = .; */ /* KEEP(*(.storage_device)) */ /* storage_device_end = .; */ #if (!TCFG_LED7_RUN_RAM) . = ALIGN(4); *(.gpio_ram) . = ALIGN(4); *(.LED_code) #if (!TCFG_CODE_RUN_RAM_FM_MODE) . = ALIGN(4); *(.LED_const) . = ALIGN(4); *(.gpio_const_ram) #endif #endif . = ALIGN(4); __movable_region_start = .; *(.movable.region.1) __movable_region2_start = .; *(.movable.region.2) __movable_region3_start = .; *(.movable.region.3) __movable_region4_start = .; *(.movable.region.4) __movable_region_end = .; __movable_region1_size = ABSOLUTE(__movable_region2_start - __movable_region_start); __movable_region2_size = ABSOLUTE(__movable_region3_start - __movable_region2_start); __movable_region3_size = ABSOLUTE(__movable_region4_start - __movable_region3_start); __movable_region4_size = ABSOLUTE(__movable_region_end - __movable_region4_start); __movable_region_size = ABSOLUTE(__movable_region_end - __movable_region_start); . = ALIGN(4); /********maskrom arithmetic ****/ *(.bfilt_code) *(.bfilt_table_maskroom) /********maskrom arithmetic end****/ . = ALIGN(4); __VERSION_BEGIN = .; KEEP(*(.sys.version)) KEEP(*(.version)) __VERSION_END = .; *(.noop_version) . = ALIGN(4); *(.tech_lib.aec.text) . = ALIGN(4); #include "btstack/btstack_lib_text.ld" . = ALIGN(4); #include "system/system_lib_text.ld" . = ALIGN(4); update_target_begin = .; PROVIDE(update_target_begin = .); KEEP(*(.update_target)) update_target_end = .; PROVIDE(update_target_end = .); . = ALIGN(4); . = ALIGN(4); *(.ui_ram) . = ALIGN(4); #include "ui/ui/ui.ld" . = ALIGN(4); #include "media/cpu/br25/media_lib_text.ld" . = ALIGN(4); *(.wav_dec_sparse_code) *(.wav_dec_sparse_const) *(.wav_dec_code) *(.wav_dec_const) *(.wav_const) *(.wav_code) . = ALIGN(4); *(.amr_const) *(.amr_code) *(.amr_dec_const) *(.amr_dec_code) *(.amr_dec_sparse_code) *(.amr_dec_sparse_const) *(.amr_dec_ff_const) . = ALIGN(4); *(.ape_dec_sparse_code) *(.ape_dec_sparse_const) *(.ape_dec_code) *(.ape_dec_const) *(.ape_bss) *(.ape_const) *(.ape_code) . = ALIGN(4); *(.flac_dec_sparse_code) *(.flac_dec_sparse_const) *(.flac_dec_code) *(.flac_dec_const) *(.flac_const) *(.flac_code) . = ALIGN(4); *(.alac_dec_code) . = ALIGN(4); #if (!VM_SPI_CODE_SEC_AT_DATA_RAM) . = ALIGN(4); _SPI_CODE_START = . ; *(.spi_code) . = ALIGN(4); _SPI_CODE_END = . ; #endif *(.text*) *(.LOG_TAG_CONST*) *(.rodata*) . = ALIGN(4); PROVIDE(flash_code_end = flash_code_begin + 1M); } > code0 . = ORIGIN(ram0); //TLB 起始需要16K 对齐; .mmu_tlb ALIGN(0x4000): { *(.mmu_tlb_segment); } > ram0 .boot_info ALIGN(32): { *(.boot_info) . = ALIGN(32); } > ram0 .irq_stack ALIGN(32): { _cpu0_sstack_begin = .; PROVIDE(cpu0_sstack_begin = .); *(.stack) _cpu0_sstack_end = .; PROVIDE(cpu0_sstack_end = .); _stack_end = . ; . = ALIGN(4); } > ram0 .data ALIGN(32): { . = ALIGN(4); *(.data_magic) . = ALIGN(32); . = ALIGN(4); *(.data*) #if TCFG_DEC_WAV_ENABLE *(.wav_dec_data) *(.wav_data) #endif . = ALIGN(4); #include "btstack/btstack_lib_data.ld" . = ALIGN(4); #include "system/system_lib_data.ld" . = ALIGN(4); #include "media/cpu/br25/media_lib_data.ld" . = ALIGN(4); EQ_COEFF_BASE = . ; . = EQ_COEFF_BASE + 4 * EQ_SECTION_NUM * 14; . = ALIGN(4); } > ram0 .bss ALIGN(32): { *(.usb_h_dma) //由于usb有个bug,会导致dma写的数据超出预设的buf,最长可能写超1k,为了避免死机,所以usb dma buffer后面放一些其他模块的buff来避免死机 *(.usb_ep0) *(.dec_mix_buff) *(.sd0_var) *(.sd1_var) *(.dac_buff) . = ALIGN(4); #include "btstack/btstack_lib_bss.ld" . = ALIGN(4); #include "system/system_lib_bss.ld" . = ALIGN(4); #include "media/cpu/br25/media_lib_bss.ld" . = ALIGN(4); #if TCFG_DEC_WAV_ENABLE *(.wav_bss) *(.wav_dec_bss) #endif *(.bss) . = ALIGN(4); *(.dts_dec_bss) *(.dts_bss) . = ALIGN(4); *(.m4a_dec_bss) *(.m4a_bss) . = ALIGN(4); *(COMMON) *(.volatile_ram) *(.audio_play_dma) . = ALIGN(4); *(.src_filt) *(.src_dma) . = ALIGN(4); *(.non_volatile_ram) . = ALIGN(32); #if TCFG_USB_CDC_BACKGROUND_RUN *(.usb_cdc_dma) *(.usb_config_var) *(.cdc_var) #endif #if (USB_MEM_NO_USE_OVERLAY_EN) *(.usb_audio_play_dma) *(.usb_audio_rec_dma) *(.uac_rx) *(.mass_storage) *(.usb_msd_dma) *(.usb_hid_dma) *(.usb_iso_dma) *(.usb_cdc_dma) *(.uac_var) *(.usb_config_var) *(.cdc_var) . = ALIGN(32); #endif } > ram0 data_code_limit_begin = .; .data_code ALIGN(32): { data_code_begin = .; *(.common*) . = ALIGN(4); #include "media/cpu/br25/media_lib_data_text.ld" #if (TCFG_CODE_RUN_RAM_FM_MODE) *(.usr_timer_const) *(.timer_const) *(.cbuf_const) *(.fm_data_const) #if (!TCFG_LED7_RUN_RAM) . = ALIGN(4); *(.LED_const) . = ALIGN(4); *(.gpio_const_ram) #endif . = ALIGN(4); /* *(.usr_timer_code) */ /* *(.timer_code) */ /* *(.cbuf_code) */ /* *(.fm_data_code) */ /* . = ALIGN(4); */ #endif . = ALIGN(4); __app_movable_slot_start = .; *(.movable.slot.1) __app_movable_slot2_start = .; *(.movable.slot.2) __app_movable_slot3_start = .; *(.movable.slot.3) __app_movable_slot4_start = .; *(.movable.slot.4) __app_movable_slot_end = .; *(.flushinv_icache) *(.os_critical_code) *(.os_rewrite_code) *(.volatile_ram_code) *(.chargebox_code) *(.fat_data_code) #if (VM_SPI_CODE_SEC_AT_DATA_RAM) . = ALIGN(4); _SPI_CODE_START = . ; *(.spi_code) . = ALIGN(4); _SPI_CODE_END = . ; #endif #if (TCFG_LED7_RUN_RAM) . = ALIGN(4); *(.gpio_const_ram) . = ALIGN(4); *(.gpio_ram) . = ALIGN(4); *(.LED_code) . = ALIGN(4); *(.LED_const) #endif . = ALIGN(4); *(.movable.stub.1) *(.movable.stub.2) *(.movable.stub.3) *(.movable.stub.4) *(*.text.cache.L1) *(*.text.const.cache.L2) . = ALIGN(4); data_code_end = .; } > ram0 .vir_timer ALIGN(32): { *(.vir_rtc) } > ram0 overlay_begin = .; OVERLAY : NOCROSSREFS AT(0x200000) SUBALIGN(4) { .overlay_aec { *(.cvsd_data) *(.cvsd_const) *(.cvsd_code) LONG(0xFFFFFFFF); /* KEEP(*(.aec_bss_id)) */ o_aec_end = .; *(.cvsd_codec) *(.aec_mem) *(.msbc_enc) *(.cvsd_bss) #if (RECORDER_MIX_EN) *(.enc_file_mem) #endif/*RECORDER_MIX_EN*/ #if TCFG_BLUETOOTH_BACK_MODE == 0 . = ALIGN(4); *(.bd_base) *(.bredr_rxtx_bulk) acl_tx_pool = .; *(.bredr_tx_bulk) #ifdef CONFIG_BT_TX_BUFF_SIZE acl_tx_pool_end = acl_tx_pool + CONFIG_BT_TX_BUFF_SIZE; #else acl_tx_pool_end = acl_tx_pool; #endif . = acl_tx_pool_end; acl_rx_pool = .; *(.bredr_rx_bulk) #ifdef CONFIG_BT_RX_BUFF_SIZE acl_rx_pool_end = acl_rx_pool + CONFIG_BT_RX_BUFF_SIZE; #else acl_rx_pool_end = acl_rx_pool; #endif . = acl_rx_pool_end; tws_bulk_pool = .; #ifdef CONFIG_TWS_BULK_POOL_SIZE tws_bulk_pool_end = tws_bulk_pool + CONFIG_TWS_BULK_POOL_SIZE; #else tws_bulk_pool_end = tws_bulk_pool; #endif . = tws_bulk_pool_end; *(.btstack_hdl_pool) #endif } .overlay_mp3 { #ifdef CONFIG_MP3_WMA_LIB_SPECIAL *(.mp3_decstream_const) *(.mp3_decstream_code) *(.mp3_decstream_sparse_code) *(.mp3_decstream_sparse_const) *(.mp3_dec_sparse_code) *(.mp3_dec_sparse_const) *(.mp3_dec_code) *(.mp3_dec_const) /* *(.mp3_dec_data) */ /* *(.mp3_dec_bss) */ /* *(.mp3_bss) */ /* *(.mp3_data) */ *(.mp3_const) *(.mp3_code) #endif LONG(0xFFFFFFFF); /* KEEP(*(.mp3_bss_id)) */ o_mp3_end = .; *(.mp3_mem) *(.mp3_ctrl_mem) *(.mp3pick_mem) *(.mp3pick_ctrl_mem) } .overlay_wma { #ifdef CONFIG_MP3_WMA_LIB_SPECIAL *(.wma_dec_code) *(.wma_dec_const) /* *(.wma_dec_data) */ /* *(.wma_dec_bss) */ /* *(.wma_bss) */ /* *(.wma_data) */ *(.wma_const) *(.wma_code) #endif LONG(0xFFFFFFFF); /* KEEP(*(.wma_bss_id)) */ o_wma_end = .; *(.wma_mem) *(.wma_ctrl_mem) *(.wmapick_mem) *(.wmapick_ctrl_mem) } .overlay_wav { LONG(0xFFFFFFFF); /* KEEP(*(.wav_bss_id)) */ o_wav_end = .; *(.wav_mem) *(.wav_ctrl_mem) } .overlay_ape { LONG(0xFFFFFFFF); /* KEEP(*(.ape_bss_id)) */ o_ape_end = .; *(.ape_mem) *(.ape_ctrl_mem) *(.ape_dec_data) *(.ape_dec_bss) *(.ape_data) } .overlay_flac { LONG(0xFFFFFFFF); /* KEEP(*(.flac_bss_id)) */ o_flac_end = .; *(.flac_mem) *(.flac_ctrl_mem) *(.flac_dec_data) *(.flac_dec_bss) *(.flac_bss) *(.flac_data) } .overlay_m4a { LONG(0xFFFFFFFF); /* KEEP(*(.m4a_bss_id)) */ o_m4a_end = .; *(.m4a_mem) *(.m4a_ctrl_mem) *(.m4a_dec_data) *(.m4a_data) *(.m4apick_mem) *(.m4apick_ctrl_mem) *(.aac_ctrl_mem) *(.aac_bss) *(.aac_data) *(.alac_ctrl_mem) *(.alac_bss) *(.alac_data) } .overlay_amr { LONG(0xFFFFFFFF); /* KEEP(*(.amr_bss_id)) */ o_amr_end = .; *(.amr_mem) *(.amr_ctrl_mem) } .overlay_dts { LONG(0xFFFFFFFF); /* KEEP(*(.dts_bss_id)) */ o_dts_end = .; *(.dts_mem) *(.dts_ctrl_mem) *(.dts_dec_data) *(.dts_data) } .overlay_fm { *(.fm_code) LONG(0xFFFFFFFF); /* KEEP(*(.fm_bss_id)) */ o_fm_end = .; *(.fm_mem) *(.linein_pcm_mem) #if TCFG_CODE_RUN_OVERLAY_FM_MODE . = ALIGN(4); __fm_overlay_movable_saddr = .; *(.fm_overlay_movable_code) __fm_overlay_movable_eaddr = __fm_overlay_movable_saddr + CONFIG_FM_MOVABLE_CODE_SIZE; . = __fm_overlay_movable_eaddr; #endif } .overlay_pc { #if (!USB_MEM_NO_USE_OVERLAY_EN) *(.usb_audio_play_dma) *(.usb_audio_rec_dma) *(.uac_rx) *(.mass_storage) *(.usb_msd_dma) *(.usb_hid_dma) *(.usb_iso_dma) *(.usb_cdc_dma) *(.uac_var) *(.usb_config_var) *(.cdc_var) #endif } } > ram0 overlay_end = .; #ifdef CONFIG_CODE_BANK_ENABLE bank_code_run_addr = .; OVERLAY : AT(0x300000) SUBALIGN(4) { .overlay_bank0 { *(.bank.code.0*) *(.bank.const.0*) . = ALIGN(4); } .overlay_bank1 { *(.bank.code.1*) *(.bank.const.1*) . = ALIGN(4); } .overlay_bank2 { *(.bank.code.2*) *(.bank.const.2*) *(.bank.ecdh.*) . = ALIGN(4); } .overlay_bank3 { *(.bank.code.3*) *(.bank.const.3*) *(.bank.enc.*) . = ALIGN(4); } .overlay_bank4 { *(.bank.code.4*) *(.bank.const.4*) . = ALIGN(4); } .overlay_bank5 { *(.bank.code.5*) *(.bank.const.5*) . = ALIGN(4); } .overlay_bank6 { *(.bank.code.6*) *(.bank.const.6*) . = ALIGN(4); } .overlay_bank7 { *(.bank.code.7*) *(.bank.const.7*) . = ALIGN(4); } .overlay_bank8 { *(.bank.code.8*) *(.bank.const.8*) . = ALIGN(4); } .overlay_bank9 { *(.bank.code.9*) *(.bank.const.9*) . = ALIGN(4); } } > ram0 #endif /* #ifdef CONFIG_CODE_BANK_ENABLE */ data_code_limit_end = .; _HEAP_BEGIN = .; _HEAP_END = RAM_END; } #include "update/update.ld" #include "driver/cpu/br25/driver_lib.ld" #include "btctrler/port/br25/btctler_lib.ld" ASSERT(__movable_region1_size <= CONFIG_FM_MOVABLE_CODE_SIZE, "__movable_region1_size > CONFIG_FM_MOVABLE_CODE_SIZE, Please modify CONFIG_FM_MOVABLE_CODE_SIZE"); //================== Section Info Export ====================// text_begin = ADDR(.text); text_size = SIZEOF(.text); text_end = ADDR(.text) + SIZEOF(.text); bss_begin = ADDR(.bss); bss_size = SIZEOF(.bss); bss_end = bss_begin + bss_size; data_addr = ADDR(.data); data_begin = text_begin + text_size; data_size = SIZEOF(.data); data_code_addr = ADDR(.data_code); data_code_begin = data_begin + data_size; data_code_size = SIZEOF(.data_code); //================ OVERLAY Code Info Export ==================// aec_addr = ADDR(.overlay_aec); aec_begin = data_code_begin + data_code_size; aec_size = o_aec_end - aec_addr; /* aec_size = SIZEOF(.overlay_aec); */ wav_addr = ADDR(.overlay_wav); wav_begin = aec_begin + aec_size; wav_size = o_wav_end - wav_addr; ape_addr = ADDR(.overlay_ape); ape_begin = wav_begin + wav_size; ape_size = o_ape_end - ape_addr; flac_addr = ADDR(.overlay_flac); flac_begin = ape_begin + ape_size; flac_size = o_flac_end - flac_addr; m4a_addr = ADDR(.overlay_m4a); m4a_begin = flac_begin + flac_size; m4a_size = o_m4a_end - m4a_addr; amr_addr = ADDR(.overlay_amr); amr_begin = m4a_begin + m4a_size; amr_size = o_amr_end - amr_addr; dts_addr = ADDR(.overlay_dts); dts_begin = amr_begin + amr_size; dts_size = o_dts_end - dts_addr; fm_addr = ADDR(.overlay_fm); fm_begin = dts_begin + dts_size; fm_size = o_fm_end - fm_addr; /* fm_size = SIZEOF(.overlay_fm); */ #ifdef CONFIG_MP3_WMA_LIB_SPECIAL mp3_addr = ADDR(.overlay_mp3); mp3_begin = fm_begin + fm_size; mp3_size = o_mp3_end - mp3_addr; wma_addr = ADDR(.overlay_wma); wma_begin = mp3_begin + mp3_size; wma_size = o_wma_end - wma_addr; overlay_code_end_addr = wma_begin + wma_size; #else overlay_code_end_addr = fm_begin + fm_size; #endif //================ Bank Code Info Export ==================// bank_code_load_addr = overlay_code_end_addr; //===================== HEAP Info Export =====================// PROVIDE(HEAP_BEGIN = _HEAP_BEGIN); PROVIDE(HEAP_END = _HEAP_END); _MALLOC_SIZE = _HEAP_END - _HEAP_BEGIN; PROVIDE(MALLOC_SIZE = _HEAP_END - _HEAP_BEGIN);