Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOWTO]: Add a 'prog' action to conf.lua #113

Open
ThomasHornschuh opened this issue Nov 1, 2017 · 3 comments
Open

[HOWTO]: Add a 'prog' action to conf.lua #113

ThomasHornschuh opened this issue Nov 1, 2017 · 3 comments

Comments

@ThomasHornschuh
Copy link
Contributor

Hi,
I tried hard to understand the elua build system and activate a prog action to my build to run the genprog function to strip a binary from the elf file. I didn't get it working yet. Below you can see my conf.lua, I expect that the line tools.bonfire.prog_flist = { output .. ".bin"} will create a dependency to build the bin file. But it is not working. What am I missing?

-- Configuration file for the RV32IM on bonfire Platform
-- Intended to run standalone


if comp.cpu:lower()=="bonfire_arty_10" then
  specific_files = sf( "start.S platform.c stubs.c uart.c systimer.c console.c platform_int.c mod_riscv.c xil_etherlite.c", comp.cpu:lower() )
else
   specific_files = sf( "start.S platform.c stubs.c uart.c systimer.c console.c platform_int.c mod_riscv.c", comp.cpu:lower() )
end
--local ldscript = "src/platform/bonfire/riscv_local.ld"
local ldscript = sf( "src/platform/%s/%s", platform, "riscv_local.ld" )

-- Override default optimize settings
delcf{ "-Os", "-fomit-frame-pointer" }
addcf{"-g", "-O2","-fomit-frame-pointer"}

-- Prepend with path
specific_files = utils.prepend_path( specific_files, sf( "src/platform/%s", platform ) )


-- Standard GCC flags

addcf{ '-march=rv32im' ,'-mabi=ilp32' }
addcf{ '-ffunction-sections', '-fdata-sections', '-fno-strict-aliasing', '-Wall'}
addlf{ '-nostartfiles', '-nostdlib', '-T', ldscript, '-Wl,--gc-sections', '-Wl,--allow-multiple-definition' }
addlib{ 'c','gcc','m' }



local gcc_version=utils.exec_capture(comp.CC.." -dumpversion")
print(string.format("Found %s version %s",comp.CC, gcc_version))
if gcc_version:sub(1,1)>="7" then -- For RISCV gcc version >= 7
  print("Configuring for gcc Version >= 7")
  addcf{'-mstrict-align','-mbranch-cost=6'}
else
  print("Configuring for gcc Version < 7")
end


-- Also tell the builder that we don't need dependency checks for assembler files
--builder:set_asm_dep_cmd( false )

-- Toolset data
tools.bonfire = {}
tools.bonfire.prog_flist = { output .. ".bin"}

-- Programming function for i386 (not needed, empty function)
--tools.bonfire.progfunc = function( target, deps )
  --print "bonfire.progfunc"
  --return 0
--end

-- Add the programming function explicitly for this target
--tools.bonfire.pre_build = function()
  --local t = builder:target( "#phony:prog", { exetarget }, tools.bonfire.progfunc )
  --builder:add_target( t, "build eLua firmware image", { "prog" } )
--end
@bogdanm
Copy link
Member

bogdanm commented Nov 15, 2017

Hi,

Maybe you could explain what you're trying to do? eLua should already build a .bin file as part of the build process.

@ThomasHornschuh
Copy link
Contributor Author

Hi, I want exactly what you describe: That a bin file is generated from the elf.
In the next step (optionally) I may also add other steps like uploading the bin file, but this is was not my question yet.

@bogdanm
Copy link
Member

bogdanm commented Nov 18, 2017

The "prog" targets created in https://github.com/elua/elua/blob/master/build_elua.lua#L453 should take of this automatically. I'm not sure why this isn't working for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants