craftr-build / craftr-build-4.x

Frontend for the Craftr build framework.
https://craftr-build.github.io/craftr/
Other
60 stars 14 forks source link

Add objcopy() rule to compiler modules #20

Closed NiklasRosenstein closed 8 years ago

NiklasRosenstein commented 9 years ago

A rule objcopy() to invoke the GNU objcopy tool should be added.

NiklasRosenstein commented 9 years ago

I'm thinking about delaying this when there would be a higher demand and the need to provide an abstract interface to the objcopy tool. For now, it can easily be written with a standard target() definition.

testbin = target(
  inputs = testelf,
  outputs = [join(project_dir, 'test.bin')],
  command = ['objcopy', '-O', 'binary', '%%in'],
)
winksaville commented 9 years ago

SG

On Sun, Oct 25, 2015, 1:25 PM Niklas Rosenstein notifications@github.com wrote:

I'm thinking about delaying this when there would be a higher demand and the need to provide an abstract interface to the objcopy tool. For now, it can easily be written with a standard target() definition.

testbin = target( inputs = testelf, outputs = [join(project_dir, 'test.bin')], command = ['objcopy', '-O', 'binary', '%%in'], )

— Reply to this email directly or view it on GitHub https://github.com/craftr-build/craftr/issues/20#issuecomment-150965853.

NiklasRosenstein commented 8 years ago

With Craftr 0.20.0-dev, this target would look like this instead:

testbin = Target(
  command = 'objcopy -O binary $in',
  inputs = teself,
  outputs = [path.local('test.bin')],
)
winksaville commented 8 years ago

I'd sure like to be able to create an ObjCopy translator with the command specified and then use the ObjCopy translator with various inputs and outputs.

On Mon, Dec 7, 2015 at 9:55 AM Niklas Rosenstein notifications@github.com wrote:

With Craftr 0.20.0-dev, this target would look like this instead:

testbin = Target( command = 'objcopy -O binary $in', inputs = teself, outputs = [path.local('test.bin')], )

— Reply to this email directly or view it on GitHub https://github.com/craftr-build/craftr/issues/20#issuecomment-162607487.

NiklasRosenstein commented 8 years ago

Ok, I've added an Objcopy class to the unix extension module, see 91c6d7b. You would use it like this:

from craftr.ext import unix
objcopy = unix.Objcopy(program='arm-eabi-objcopy')
testbin = objcopy.objcopy(
  inputs = testelf,
  output_format = 'binary',
)

Note that this is very experimental as I don't really have something to test this here. By default, the class will call objcopy --help and use regex to find the supported targets. If you choose an output_format or input_format that was not in that list of supported targets, there'll be an error.

winksaville commented 8 years ago

You can fork my project, but I'll give it ago sometime soon.

On Thu, Dec 10, 2015, 9:48 AM Niklas Rosenstein notifications@github.com wrote:

Ok, I've added an Objcopy class to the unix extension module, see 91c6d7b https://github.com/craftr-build/craftr/commit/91c6d7b2259b85c1223ab745bba2ac97b8c57679. You would use it like this:

from craftr.ext import unix objcopy = unix.Objcopy(program='arm-eabi-objcopy') testbin = objcopy.objcopy( inputs = testelf, output_format = 'binary', )

Note that this is very experimental as I don't really have something to test this here. By default, the class will call objcopy --help and use regex to find the supported targets. If you choose an output_format or input_format that was not in that list of supported targets, there'll be an error.

— Reply to this email directly or view it on GitHub https://github.com/craftr-build/craftr/issues/20#issuecomment-163700702.

NiklasRosenstein commented 8 years ago

I'd have a to build a cross-compiler first, no? :)

NiklasRosenstein commented 8 years ago

Ah I mess up the two issues. :) See https://github.com/craftr-build/craftr/issues/3#issuecomment-163739727

winksaville commented 8 years ago

I've created a project to make it "easy", you're welcome to give it a try.

On Thu, Dec 10, 2015 at 12:31 PM Niklas Rosenstein notifications@github.com wrote:

Ah I mess up the two issues. :) #3 (comment) https://github.com/craftr-build/craftr/issues/3#issuecomment-163739727

— Reply to this email directly or view it on GitHub https://github.com/craftr-build/craftr/issues/20#issuecomment-163741235.