123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- # Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
- # All rights reserved.
- #
- # This software is supplied "AS IS" without any warranties.
- # RDA assumes no responsibility or liability for the use of the software,
- # conveys no license or title under any patent, copyright, or mask work
- # right to the product. RDA reserves the right to make changes in the
- # software without notification. RDA also make no representation or
- # warranty that such application will be suitable for the specified use
- # without further testing or modification.
- configure_file(include/boot_config.h.in ${out_inc_dir}/boot_config.h)
- install_headers(include/image_header.h OUTPUT ${out_inc_dir})
- if(CONFIG_SOC_8910)
- set(target bootloader)
- add_library(${target} STATIC
- 8910/boot_platform.c
- 8910/boot_secure.c
- src/boot_entry_v7a.S
- src/boot_sffs_port.c
- src/boot_delay.c
- src/boot_mem.c
- src/boot_spi_flash.c
- src/boot_debuguart.c
- src/boot_trace.c
- src/boot_fdl.c
- src/boot_fdl_dnld.c
- src/boot_aes.c
- src/boot_vfs.c
- src/boot_irq_gic.c
- src/boot_timer.c
- src/boot_uart.c
- src/boot_uart_cmn.c
- src/boot_mmu.c
- src/boot_uimage.c
- src/boot_udc.c
- src/boot_usb_fdl_channel.c
- src/boot_pdl.c
- src/boot_pdl_uimage.c
- src/boot_lcd.c
- src/boot_unity.c
- src/boot_override.c
- )
- set_target_properties(${target} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${out_lib_dir})
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_include_directories(${target} PUBLIC include)
- target_link_libraries(${target} PRIVATE calclib boot_calclib_crc)
- target_include_targets(${target} PRIVATE hal fs sffs bdev driver fsmount
- nvm cpio_parser lcdpanel)
- set(rmarun_ld ldscripts/ramrun_8910.ld)
- set(target boot2)
- add_uimage(${target} ${rmarun_ld} 8910/boot2_start.c)
- target_compile_definitions(${target}_ldscript PRIVATE
- RAMRUN_IMAGE_START=${CONFIG_BOOT2_IMAGE_START}
- RAMRUN_IMAGE_SIZE=${CONFIG_BOOT2_IMAGE_SIZE}
- RAMRUN_MMU_ENABLE=1
- )
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_link_whole_archive(${target} PRIVATE bootloader)
- target_link_group(${target} PRIVATE hal osi_lib fupdate fupdate_security_boot fsmount sffs bdev)
- target_include_targets(${target} PRIVATE hal fs sffs bdev fupdate fupdate_security_boot driver)
- target_link_libraries(${target} PRIVATE ${libc_file_name} ${libgcc_file_name})
- set(boot2_img ${out_hex_dir}/boot2.img)
- set(boot2_lzma ${boot2_img}.lzmar)
- add_custom_command(OUTPUT ${boot2_lzma}
- COMMAND ${cmd_lzmare2} ${boot2_img} ${boot2_lzma}
- DEPENDS ${boot2_img}
- )
- set(target boot)
- add_uimage(${target} ${rmarun_ld} 8910/boot_start.c)
- target_compile_definitions(${target}_ldscript PRIVATE
- RAMRUN_IMAGE_START=${CONFIG_BOOT_IMAGE_START}
- RAMRUN_IMAGE_SIZE=${CONFIG_BOOT_IMAGE_SIZE}
- RAMRUN_FLASH_SIZE=${CONFIG_BOOT_UNSIGN_IMAGE_SIZE}
- RAMRUN_MMU_ENABLE=0
- )
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_link_whole_archive(${target} PRIVATE bootloader)
- target_link_group(${target} PRIVATE hal calclib boot_calclib_crc)
- target_include_targets(${target} PRIVATE kernel)
- target_link_libraries(${target} PRIVATE ${libc_file_name} ${libgcc_file_name})
- target_incbin(${target} ${boot2_lzma} gBoot2CompData BALIGN 8)
- set(target fdl1)
- add_uimage(${target} ${rmarun_ld} 8910/fdl1.c)
- target_compile_definitions(${target}_ldscript PRIVATE
- RAMRUN_IMAGE_START=${CONFIG_FDL1_IMAGE_START}
- RAMRUN_IMAGE_SIZE=${CONFIG_FDL1_IMAGE_SIZE}
- RAMRUN_FLASH_SIZE=${CONFIG_BOOT_UNSIGN_IMAGE_SIZE}
- RAMRUN_MMU_ENABLE=0
- )
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_link_whole_archive(${target} PRIVATE bootloader)
- target_link_group(${target} PRIVATE hal osi_lib)
- target_include_targets(${target} PRIVATE driver)
- target_link_libraries(${target} PRIVATE ${libc_file_name} ${libgcc_file_name})
- set(target fdl2)
- add_uimage(${target} ${rmarun_ld} 8910/fdl2.c)
- target_compile_definitions(${target}_ldscript PRIVATE
- RAMRUN_IMAGE_START=${CONFIG_FDL2_IMAGE_START}
- RAMRUN_IMAGE_SIZE=${CONFIG_FDL2_IMAGE_SIZE}
- RAMRUN_MMU_ENABLE=1
- )
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_include_targets(${target} PRIVATE fs fsmount nvm calclib cpio_parser driver)
- target_link_whole_archive(${target} PRIVATE bootloader cpio_parser)
- target_link_group(${target} PRIVATE hal calclib boot_calclib_crc sffs fsmount bdev osi_lib nvm lz4 fs)
- target_link_libraries(${target} PRIVATE ${libc_file_name} ${libgcc_file_name})
- target_incbin_size(${target} ${CMAKE_CURRENT_SOURCE_DIR}/8910/calibparam.bin gDefCalibParam gDefCalibParamSize)
- set(target flash_test_fdl)
- add_uimage(${target} ${rmarun_ld} flash_test_fdl/flash_test_main.c)
- target_compile_definitions(${target}_ldscript PRIVATE
- RAMRUN_IMAGE_START=${CONFIG_FDL1_IMAGE_START}
- RAMRUN_IMAGE_SIZE=${CONFIG_FDL1_IMAGE_SIZE}
- RAMRUN_MMU_ENABLE=0
- )
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_link_whole_archive(${target} PRIVATE bootloader)
- target_link_group(${target} PRIVATE hal osi_lib)
- target_include_targets(${target} PRIVATE driver)
- target_link_libraries(${target} PRIVATE ${libc_file_name} ${libgcc_file_name})
- endif()
- if(CONFIG_SOC_8850)
- set(target bootloader)
- add_library(${target} STATIC)
-
- set_target_properties(${target} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${out_lib_dir})
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_include_directories(${target} PUBLIC include)
- target_link_libraries(${target} PRIVATE calclib boot_calclib_crc driver fupdate boot_ex_ql) #quectel update
- target_include_targets(${target} PRIVATE hal fs sffs bdev driver fsmount nvm cpio_parser fupdate boot_ex_ql lcdpanel)
-
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_SDMMC THEN ${target} PRIVATE boot_ex_sdmmc)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_EMMC THEN ${target} PRIVATE boot_ex_emmc)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_SDMMC2 THEN ${target} PRIVATE boot_ex_sdmmc2)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_EMMC2 THEN ${target} PRIVATE boot_ex_emmc2)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_FAT_RDONLY THEN ${target} PRIVATE boot_ex_fat_rdonly)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_FAT_RW THEN ${target} PRIVATE boot_ex_fat_rw)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_SPI6_EXT_NOR THEN ${target} PRIVATE boot_ex_spi6nor)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_SPI_FLASH THEN ${target} PRIVATE boot_ex_spiflash)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_NAND_FLASH THEN ${target} PRIVATE boot_ex_nandflash)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_SPI6_NAND THEN ${target} PRIVATE boot_ex_spi6nand)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_LCD THEN ${target} PRIVATE boot_ex_lcd)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_LED THEN ${target} PRIVATE boot_ex_led)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_ADC THEN ${target} PRIVATE boot_ex_adc)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_SCATTER THEN ${target} PRIVATE boot_ex_scatter)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_SPI4_EXTNSFFS THEN ${target} PRIVATE boot_ex_spi4exnsffs boot_ex_spi4exnsffs_cfg)
- target_link_libraries_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_SPI4_NORFLASH THEN ${target} PRIVATE boot_ex_spi4norflash)
-
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_SDMMC THEN ${target} PRIVATE boot_ex_sdmmc)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_EMMC THEN ${target} PRIVATE boot_ex_emmc)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_SDMMC2 THEN ${target} PRIVATE boot_ex_sdmmc2)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_EMMC2 THEN ${target} PRIVATE boot_ex_emmc2)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_FAT_RDONLY THEN ${target} PRIVATE boot_ex_fat_rdonly)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_FAT_RW THEN ${target} PRIVATE boot_ex_fat_rw)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_SPI6_EXT_NOR THEN ${target} PRIVATE boot_ex_spi6nor)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_SPI_FLASH THEN ${target} PRIVATE boot_ex_spiflash)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_NAND_FLASH THEN ${target} PRIVATE boot_ex_nandflash)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_SPI6_NAND THEN ${target} PRIVATE boot_ex_spi6nand)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_LCD THEN ${target} PRIVATE boot_ex_lcd)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_LED THEN ${target} PRIVATE boot_ex_led)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_ADC THEN ${target} PRIVATE boot_ex_adc)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_SCATTER THEN ${target} PRIVATE boot_ex_scatter)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_SPI4_EXTNSFFS THEN ${target} PRIVATE boot_ex_spi4exnsffs boot_ex_spi4exnsffs_cfg)
- target_include_targets_if(CONFIG_QUEC_PROJECT_FEATURE_BOOT_SPI4_NORFLASH THEN ${target} PRIVATE boot_ex_spi4norflash)
-
- target_sources(${target} PRIVATE
- 8850/boot_platform.c
- 8850/boot_secure.c
- src/boot_entry_v7a.S
- src/boot_sffs_port.c
- src/boot_delay.c
- src/boot_mem.c
- src/boot_spi_flash.c
- src/boot_debuguart.c
- src/boot_trace.c
- src/boot_fdl.c
- src/boot_vfs.c
- src/boot_irq_gic.c
- src/boot_timer.c
- src/boot_ifc_uart.c
- src/boot_uart_cmn.c
- src/boot_userial.c
- src/boot_mmu.c
- src/boot_uimage.c
- src/boot_unity.c
- src/boot_override.c
- src/boot_lcd.c
- src/boot_efuse.c
- src/boot_pdl.c
- src/boot_pdl_uimage.c
- )
- set_target_properties(${target} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${out_lib_dir})
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_include_directories(${target} PUBLIC include)
- target_link_libraries(${target} PRIVATE calclib boot_calclib_crc)
- target_include_targets(${target} PRIVATE hal fs sffs bdev driver fsmount
- nvm cpio_parser lcdpanel)
- set(rmarun_ld ldscripts/ramrun_8850.ld)
- set(psrmarun_ld ldscripts/psramrun_8850.ld)
- if(NOT QL_PROJECT_MIXER)
- set(target spl)
- add_simage(${target} ${rmarun_ld} 8850/spl_start.c)
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_link_whole_archive(${target} PRIVATE bootloader)
- target_link_group(${target} PRIVATE hal calclib boot_calclib_crc fupdate fupdate_security_boot sffs bdev osi_lib fsmount boot_ex_ql) #quectel update
- target_include_targets(${target} PRIVATE kernel fs sffs bdev fupdate fupdate_security_boot fsmount driver boot_ex_ql)
- target_link_libraries(${target} PRIVATE ${libc_file_name} ${libgcc_file_name})
- set(target boot)
- add_simage(${target} ${psrmarun_ld} 8850/boot_start.c)
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_link_whole_archive(${target} PRIVATE bootloader)
- target_link_group(${target} PRIVATE hal calclib boot_calclib_crc osi_lib) #quectel update
- target_include_targets(${target} PRIVATE kernel fs sffs bdev fupdate fsmount driver)
- target_link_libraries(${target} PRIVATE ${libc_file_name} ${libgcc_file_name})
- set(target norfdl)
- add_simage(${target} ${rmarun_ld} 8850/fdl.c)
- target_compile_definitions(${target}_ldscript PRIVATE
- RAMRUN_IMAGE_START=${CONFIG_NORFDL_IMAGE_START}
- RAMRUN_IMAGE_SIZE=${CONFIG_NORFDL_IMAGE_SIZE}
- )
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_include_targets(${target} PRIVATE fs fsmount nvm calclib boot_calclib_crc cpio_parser driver boot_ex_ql) #quectel update
- target_link_whole_archive(${target} PRIVATE bootloader cpio_parser)
- target_link_group(${target} PRIVATE hal calclib boot_calclib_crc sffs fsmount bdev osi_lib nvm lz4 fs boot_ex_ql) #quectel update
- target_link_libraries(${target} PRIVATE ${libc_file_name} ${libgcc_file_name})
- endif()
- endif()
- if(CONFIG_SOC_8811)
- set(target bootloader)
- add_library(${target} STATIC
- 8811/boot_platform.c
- 8811/boot_secure.c
- src/boot_entry_v8m.S
- src/boot_sffs_port.c
- src/boot_delay.c
- src/boot_mem.c
- src/boot_spi_flash.c
- src/boot_debuguart.c
- src/boot_trace.c
- src/boot_fdl.c
- src/boot_fdl_dnld.c
- src/boot_aes.c
- src/boot_vfs.c
- src/boot_irq_nvic.c
- src/boot_timer.c
- src/boot_ifc_uart.c
- src/boot_uart_cmn.c
- src/boot_unity.c
- src/boot_override.c
- )
- if (CONFIG_TFM_SUPPORT)
- target_sources(${target} PRIVATE 8811/boot_status.c 8811/boot_rng.c)
- endif()
- set_target_properties(${target} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${out_lib_dir})
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_include_directories(${target} PUBLIC include)
- target_link_libraries(${target} PRIVATE calclib boot_calclib_crc)
- target_include_targets(${target} PRIVATE hal fs sffs bdev driver fsmount nvm cpio_parser)
- set(rmarun_ld ldscripts/ramrun_8811.ld)
- set(target boot2)
- add_simage(${target} ${rmarun_ld} 8811/boot2_start.c)
- target_compile_definitions(${target}_ldscript PRIVATE
- RAMRUN_IMAGE_START=${CONFIG_BOOT2_IMAGE_START}
- RAMRUN_IMAGE_SIZE=${CONFIG_BOOT2_IMAGE_SIZE}
- )
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_link_whole_archive(${target} PRIVATE bootloader)
- target_link_group(${target} PRIVATE hal osi_lib fupdate fupdate_security_boot fsmount sffs bdev calclib boot_calclib_crc)
- target_include_targets(${target} PRIVATE hal fs sffs bdev fupdate fupdate_security_boot driver)
- target_link_libraries(${target} PRIVATE ${libc_file_name} ${libgcc_file_name})
- set(boot2_img ${out_hex_dir}/boot2.img)
- set(boot2_lzma ${boot2_img}.lzma)
- add_custom_command(OUTPUT ${boot2_lzma}
- COMMAND ${cmd_lzmacomp} ${boot2_img}
- DEPENDS ${boot2_img}
- )
- set(target boot)
- add_simage(${target} ${rmarun_ld} 8811/boot_start.c)
- target_compile_definitions(${target}_ldscript PRIVATE
- RAMRUN_IMAGE_START=${CONFIG_BOOT_IMAGE_START}
- RAMRUN_IMAGE_SIZE=${CONFIG_BOOT_IMAGE_SIZE}
- RAMRUN_FLASH_SIZE=${CONFIG_BOOTLOADER_SIZE}
- )
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_link_whole_archive(${target} PRIVATE bootloader)
- target_link_group(${target} PRIVATE hal osi_lib fupdate fupdate_security_boot fsmount sffs bdev calclib boot_calclib_crc)
- target_include_targets(${target} PRIVATE hal fs sffs bdev fupdate fupdate_security_boot driver)
- target_link_libraries(${target} PRIVATE ${libc_file_name} ${libgcc_file_name})
- target_incbin_size(${target} ${boot2_lzma} gBoot2CompData gBoot2CompSize BALIGN 8)
- set(target norfdl)
- add_simage(${target} ${rmarun_ld} 8811/fdl.c)
- target_compile_definitions(${target}_ldscript PRIVATE
- RAMRUN_IMAGE_START=${CONFIG_NORFDL_IMAGE_START}
- RAMRUN_IMAGE_SIZE=${CONFIG_NORFDL_IMAGE_SIZE}
- )
- target_compile_definitions(${target} PRIVATE OSI_LOG_TAG=LOG_TAG_BOOT)
- target_include_targets(${target} PRIVATE fs fsmount nvm calclib cpio_parser driver)
- target_link_whole_archive(${target} PRIVATE bootloader cpio_parser)
- target_link_group(${target} PRIVATE hal calclib boot_calclib_crc sffs fsmount bdev osi_lib nvm lz4 fs)
- target_link_libraries(${target} PRIVATE ${libc_file_name} ${libgcc_file_name})
- endif()
- relative_glob(srcs include/*.h src/*.[ch]
- 8811/*.[ch] 8910/*.[ch] 8850/*.[ch]
- fdl1/*.[ch] fdl2/*.[ch] flash_test_fdl/*.[ch]
- boot/*.[ch] uart_ramrun/*.[ch] spl_start/*.[ch]
- )
- beautify_c_code(bootloader ${srcs})
|