Skip to content

Commit

Permalink
add:支持718pm
Browse files Browse the repository at this point in the history
  • Loading branch information
Dozingfiretruck committed Dec 4, 2024
1 parent 3cbf74b commit b8207ce
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 29 deletions.
12 changes: 6 additions & 6 deletions bootloader/bootloader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ target("driver",function()
{public = true})

add_files(
-- csdk_root.."/PLAT/core/code/boot_code.c",
-- csdk_root.."/PLAT/core/code/fota_code.c",
-- driver
csdk_root.."/PLAT/driver/board/ec7xx_0h00/src/plat_config.c",
csdk_root.."/PLAT/driver/hal/ec7xx/ap/src/hal_pwrkey.c",
Expand Down Expand Up @@ -80,7 +78,7 @@ target("ap_bootloader.elf",function()

if has_config("chip_target") then
chip_target = get_config("chip_target")
LIB_PRODUCT = ((chip_target == "ec718um" and "ec718um") or (chip_target == "ec718hm" and "ec718hm") or (chip_target=="ec718e"and"ec718p"or chip_target):sub(1,6))
LIB_PRODUCT = ((chip_target == "ec718um" and "ec718um") or (chip_target == "ec718hm" and "ec718hm") or (chip_target == "ec718pm" and "ec718hm") or (chip_target=="ec718e"and"ec718p"or chip_target):sub(1,6))
set_values("LIB_PRODUCT", LIB_PRODUCT)
end
if chip_target and lib_ps_plat then
Expand All @@ -91,6 +89,8 @@ target("ap_bootloader.elf",function()
add_linkdirs(csdk_root.."/PLAT/libs/ec718um-ims/bootloader")
elseif chip_target=="ec718hm" and lib_ps_plat=="ims" then
add_linkdirs(csdk_root.."/PLAT/libs/ec718hm-ims/bootloader")
elseif chip_target=="ec718pm" and lib_ps_plat=="ims" then
add_linkdirs(csdk_root.."/PLAT/libs/ec718pm-ims/bootloader")
else
add_linkdirs(csdk_root.."/PLAT/libs/"..(chip_target=="ec718e"and"ec718p"or chip_target)..(lib_ps_plat=="mid"and"-mid"or"").."/bootloader")
end
Expand All @@ -104,7 +104,7 @@ target("ap_bootloader.elf",function()
{whole = true, group = true})

if chip_target then
if chip_target=="ec718um" or chip_target == "ec718hm" then
if chip_target=="ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm" then
add_ldflags("-T"..csdk_root.."/PLAT/core/ld/ec718xm/ec7xx_0h00_flash_bl.ld","-Wl,-Map,"..project_dir.."/build/ap_bootloader/ap_bootloader_debug.map",{force = true})
else
add_ldflags("-T"..csdk_root.."/PLAT/core/ld/ec7xx_0h00_flash_bl.ld","-Wl,-Map,"..project_dir.."/build/ap_bootloader/ap_bootloader_debug.map",{force = true})
Expand Down Expand Up @@ -139,7 +139,7 @@ target("ap_bootloader.elf",function()
end

if chip_target then
if chip_target=="ec718um" or chip_target == "ec718hm" then
if chip_target=="ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm" then
os.execv(toolchains .. "/arm-none-eabi-gcc",
table.join(ld_parameter,user_mem_map,
{"-I",csdk_root .. "/PLAT/device/target/board/ec7xx_0h00/common/pkginc"},
Expand Down Expand Up @@ -179,7 +179,7 @@ target("ap_bootloader.elf",function()
io.writefile(project_dir.."/build/ap_bootloader/ap_bootloader.size", os.iorun(toolchains .. "/arm-none-eabi-objdump -h "..project_dir.."/build/ap_bootloader/ap_bootloader.elf"))
local size_file = io.open(project_dir.."/build/ap_bootloader/ap_bootloader.size", "a")
size_file:write(os.iorun(toolchains .. "/arm-none-eabi-size -G "..project_dir.."/build/ap_bootloader/ap_bootloader.elf"))
if LIB_PRODUCT == "ec718p" or LIB_PRODUCT == "ec718u" or LIB_PRODUCT == "ec718um" or LIB_PRODUCT == "ec718hm" then
if LIB_PRODUCT == "ec718p" or LIB_PRODUCT == "ec718u" or LIB_PRODUCT == "ec718um" or LIB_PRODUCT == "ec718hm" or LIB_PRODUCT == "ec718pm" then
size_file:write(os.iorun(toolchains .. "/arm-none-eabi-size -t -G "..csdk_root.."/lib/libffota_eflash.a"))
end
size_file:write(os.iorun(toolchains .. "/arm-none-eabi-size -t -G "..project_dir.."/build/bootloader_libdriver/libdriver.a"))
Expand Down
24 changes: 14 additions & 10 deletions csdk.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function description_common()
set_values("luatos_root", luatos_root)

option("chip_target", {default = "ec718p", showmenu = true,
values={"ec716e","ec716s","ec718s","ec718e","ec718p","ec718pv","ec718u","ec718um","ec718hm"},
values={"ec716e","ec716s","ec718s","ec718e","ec718p","ec718pv","ec718u","ec718um","ec718hm","ec718pm"},
description = "chip target"})
add_options("chip_target")
if has_config("chip_target") then chip_target = get_config("chip_target") end
Expand All @@ -55,7 +55,7 @@ function description_common()
set_showmenu(true)
chip_target = get_config("chip_target")
-- 先统一显示出来,后面支持动态显示在调整
set_description("lspd mode. 716s/ec718s disable get sms,wifi,hib, enable get rndis. 718p/718e/716e/ enable get more memory. ec718pv ec718u ec718um ec718hm always enable")
set_description("lspd mode. 716s/ec718s disable get sms,wifi,hib, enable get rndis. 718p/718e/716e/ enable get more memory. ec718pv ec718u ec718um ec718hm ec718pm always enable")

-- if chip_target ~= "ec718p" and chip_target ~= "ec718pv" and chip_target ~= "ec718e" then
-- set_description("lspd mode. enable can get sms,wifi,hib power mode, disable can get rndis")
Expand All @@ -73,7 +73,7 @@ function description_common()
set_default(false)
set_showmenu(true)
chip_target = get_config("chip_target")
set_description("denoise mode. enable can use amr encode to support noise reduction. only ec718p need config. ec718u ec718um ec718hm always enable ,other always disable, no need config ")
set_description("denoise mode. enable can use amr encode to support noise reduction. only ec718p need config. ec718u ec718um ec718hm ec718pm always enable ,other always disable, no need config ")
-- after_check(function (option)
-- if get_config("chip_target") ~= "ec718p" then
-- option:enable(false)
Expand Down Expand Up @@ -101,11 +101,13 @@ function description_common()
add_defines("CHIP_EC718","TYPE_EC718M","TYPE_EC718UM")
elseif chip_target == "ec718hm" then
add_defines("CHIP_EC718","TYPE_EC718M","TYPE_EC718HM")
elseif chip_target == "ec718hm" then
add_defines("CHIP_EC718","TYPE_EC718M","TYPE_EC718PM")
end

if (chip_target == "ec718p" or chip_target == "ec718e") and has_config("lspd_mode") or
chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" or chip_target == "ec718pv" or
chip_target == "ec716s" or chip_target == "ec716e" or chip_target == "ec718s" then
chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm"
or chip_target == "ec718pv" or chip_target == "ec716s" or chip_target == "ec716e" or chip_target == "ec718s" then
add_defines("OPEN_CPU_MODE")
end
add_includedirs(csdk_root.."/PLAT/driver/hal/ec7xx/ap/inc/"..CHIP,
Expand All @@ -118,15 +120,15 @@ function description_common()
lib_fw = "oc"
if has_config("lspd_mode") then
if (chip_target == "ec718p" and has_config("denoise_force")) or
((chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm") and has_config("denoise_force"))then
((chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm") and has_config("denoise_force"))then
lib_fw = "audio"
lib_ps_plat = "oc"
add_defines("FEATURE_AMR_CP_ENABLE","FEATURE_VEM_CP_ENABLE")
elseif chip_target == "ec718pv" then
lib_fw = "audio"
lib_ps_plat = "ims"
add_defines("FEATURE_AMR_CP_ENABLE","FEATURE_VEM_CP_ENABLE")
elseif chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" then
elseif chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm" then
lib_ps_plat = "oc"
elseif chip_target == "ec716e" then
lib_fw = "ram"
Expand All @@ -138,7 +140,7 @@ function description_common()
if (chip_target == "ec718p" and has_config("denoise_force")) or (chip_target == "ec718e" and has_config("denoise_force")) then
lib_fw = "audio"
add_defines("FEATURE_AMR_CP_ENABLE","FEATURE_VEM_CP_ENABLE")
elseif chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" or chip_target == "ec718pv" then
elseif chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm" or chip_target == "ec718pv" then
lib_fw = "audio"
lib_ps_plat = "ims"
add_defines("FEATURE_AMR_CP_ENABLE","FEATURE_VEM_CP_ENABLE")
Expand Down Expand Up @@ -283,8 +285,8 @@ function description_common()

local csdk_root = target:values("csdk_root")
local chip_target = get_config("chip_target")
assert (chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" or chip_target == "ec718e" or chip_target == "ec718p" or chip_target == "ec718pv" or chip_target == "ec718s" or chip_target == "ec716s" or chip_target == "ec716e" ,
"target only support ec718u/ec718um/ec718hm/ec718e/ec718p/ec718pv/ec718s/ec716s/ec716e")
assert (chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm" or chip_target == "ec718e" or chip_target == "ec718p" or chip_target == "ec718pv" or chip_target == "ec718s" or chip_target == "ec716s" or chip_target == "ec716e" ,
"target only support ec718u/ec718um/ec718hm/ec718pm/ec718e/ec718p/ec718pv/ec718s/ec716s/ec716e")

if target:name()== target:values("project_name") then
cprint(format("${cyan}CPU : ${red}%s",os.cpuinfo("model_name")))
Expand Down Expand Up @@ -326,6 +328,8 @@ function description_common()
libs_plat = "ec718um-ims"
elseif chip_target=="ec718hm" and target:values("lib_ps_plat")=="ims" then
libs_plat = "ec718hm-ims"
elseif chip_target=="ec718pm" and target:values("lib_ps_plat")=="ims" then
libs_plat = "ec718pm-ims"
end
-- print("libs_plat:",libs_plat)
local libs_plat_dir = csdk_root.."/PLAT/libs/"..libs_plat
Expand Down
26 changes: 13 additions & 13 deletions project/project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ function description_csdk()
use_lto = true
end

if chip_target == "ec718p" or chip_target == "ec718pv" or chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" then
if chip_target == "ec718p" or chip_target == "ec718pv" or chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm" then
add_defines("PSRAM_FEATURE_ENABLE")
--add_defines("FEATURE_EXCEPTION_FLASH_DUMP_ENABLE")
end

if (chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm") and lib_ps_plat == "ims" or chip_target == "ec718pv" then
if (chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm") and lib_ps_plat == "ims" or chip_target == "ec718pv" then
add_defines("FEATURE_IMS_ENABLE",
"FEATURE_IMS_CC_ENABLE",
"FEATURE_IMS_SMS_ENABLE",
Expand Down Expand Up @@ -49,7 +49,7 @@ function description_csdk()
else
add_defines("DHCPD_ENABLE_DEFINE=1")
end
if (chip_target=="ec718u" or chip_target=="ec718um" or chip_target=="ec718hm") and lib_ps_plat == "ims" then
if (chip_target=="ec718u" or chip_target=="ec718um" or chip_target=="ec718hm" or chip_target=="ec718pm") and lib_ps_plat == "ims" then
add_includedirs(csdk_root.."/PLAT/tools/"..(chip_target)..("-ims"))
else
add_includedirs(csdk_root.."/PLAT/tools/"..(chip_target=="ec718e"and"ec718p"or chip_target)..(lib_ps_plat=="mid"and"-mid"or""))
Expand Down Expand Up @@ -170,7 +170,7 @@ function description_csdk()
luatos_root .. "/components/io_queue",
csdk_root.."/interface/include")

if chip_target == "ec718pv" or chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" then
if chip_target == "ec718pv" or chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm" then
add_includedirs(luatos_root .. "/components/cjson")
end
end
Expand Down Expand Up @@ -208,10 +208,10 @@ target("csdk",function()
if CHIP then
add_files(csdk_root.."/PLAT/driver/chip/ec7xx/ap/src/"..CHIP.."/adc.c")
end
if chip_target ~= "ec718pv" and chip_target ~= "ec718u" and chip_target ~= "ec718um" and chip_target ~= "ec718hm" then
if chip_target ~= "ec718pv" and chip_target ~= "ec718u" and chip_target ~= "ec718um" and chip_target ~= "ec718hm" and chip_target ~= "ec718pm" then
remove_files(csdk_root.."/PLAT/driver/hal/ec7xx/ap/src/hal_voice_eng_mem.c")
end
if chip_target == "ec718um" or chip_target == "ec718hm" then
if chip_target == "ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm" then
remove_files(csdk_root.."/PLAT/os/freertos/src/heap_6_psram.c")
end
remove_files(csdk_root.."/PLAT/driver/chip/ec7xx/ap/src/cspi.c",
Expand Down Expand Up @@ -249,7 +249,7 @@ target("csdk",function()
luatos_root.."/luat/vfs/luat_vfs.c")

-- cjson
if chip_target == "ec718pv" or chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" then
if chip_target == "ec718pv" or chip_target == "ec718u" or chip_target == "ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm" then
add_files(luatos_root.."/components/cjson/*.c")
end

Expand All @@ -267,7 +267,7 @@ target(project_name..".elf",function()

if has_config("chip_target") then
chip_target = get_config("chip_target")
LIB_PRODUCT = ((chip_target == "ec718um" and "ec718um") or (chip_target == "ec718hm" and "ec718hm") or (chip_target=="ec718e"and"ec718p"or chip_target):sub(1,6))
LIB_PRODUCT = ((chip_target == "ec718um" and "ec718um") or (chip_target == "ec718hm" and "ec718hm") or (chip_target == "ec718pm" and "ec718pm") or (chip_target=="ec718e"and"ec718p"or chip_target):sub(1,6))
set_values("LIB_PRODUCT", LIB_PRODUCT)
end

Expand All @@ -276,12 +276,12 @@ target(project_name..".elf",function()
add_linkdirs(csdk_root.."/PLAT/prebuild/PS/lib/gcc/"..LIB_PRODUCT.."/"..lib_ps_plat)
add_linkdirs(csdk_root.."/PLAT/prebuild/PLAT/lib/gcc/"..LIB_PRODUCT.."/"..lib_ps_plat)

if (chip_target=="ec718u" or chip_target=="ec718um" or chip_target=="ec718hm") and lib_ps_plat=="ims" then
if (chip_target=="ec718u" or chip_target=="ec718um" or chip_target=="ec718hm" or chip_target=="ec718pm") and lib_ps_plat=="ims" then
add_linkdirs(csdk_root.."/PLAT/libs/"..(chip_target)..("-ims"))
else
add_linkdirs(csdk_root.."/PLAT/libs/"..(chip_target=="ec718e"and"ec718p"or chip_target)..(lib_ps_plat=="mid"and"-mid"or""))
end
if (chip_target=="ec718u" or chip_target=="ec718um" or chip_target=="ec718hm") and lib_ps_plat=="ims" or chip_target=="ec718pv" then
if (chip_target=="ec718u" or chip_target=="ec718um" or chip_target=="ec718hm" or chip_target=="ec718pm") and lib_ps_plat=="ims" or chip_target=="ec718pv" then
add_linkgroups("imsnv","ims","imsxml", {whole = true})
end
end
Expand All @@ -295,7 +295,7 @@ target(project_name..".elf",function()

add_linkgroups(project_name, {whole = true})
if chip_target then
if chip_target=="ec718um" or chip_target == "ec718hm" then
if chip_target=="ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm" then
add_ldflags("-T"..csdk_root.."/PLAT/core/ld/ec7xxxm_0h00_flash.ld",
"-Wl,-Map,"..project_dir.."/build/"..project_name.."/"..project_name.."_$(mode).map",{force = true})
else
Expand Down Expand Up @@ -351,7 +351,7 @@ target(project_name..".elf",function()
end

if chip_target then
if chip_target=="ec718um" or chip_target == "ec718hm" then
if chip_target=="ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm" then
os.execv(toolchains .. "/arm-none-eabi-gcc",
table.join(ld_parameter,user_mem_map,
{"-I",csdk_root .. "/PLAT/device/target/board/ec7xx_0h00/common/pkginc"},
Expand Down Expand Up @@ -420,7 +420,7 @@ target(project_name..".elf",function()
os.cp("$(buildir)/"..project_name.."/*.map", out_path)
os.cp("$(buildir)/"..project_name.."/*.elf", out_path)

if chip_target=="ec718u" or chip_target=="ec718um" or chip_target == "ec718hm" and target:values("lib_ps_plat")=="ims" then
if chip_target=="ec718u" or chip_target=="ec718um" or chip_target == "ec718hm" or chip_target == "ec718pm" and target:values("lib_ps_plat")=="ims" then
os.cp(csdk_root .. "/PLAT/tools/"..(chip_target)..("-ims").."/comdb.txt", out_path)
else
os.cp(csdk_root .. "/PLAT/tools/"..(chip_target=="ec718e"and"ec718p"or chip_target)..(target:values("lib_ps_plat")=="mid"and"-mid"or"").."/comdb.txt", out_path)
Expand Down

0 comments on commit b8207ce

Please sign in to comment.