Giter Club home page Giter Club logo

Comments (3)

silvergasp avatar silvergasp commented on September 20, 2024

Hmm, I mustn't have defined the path for objcopy. So this is definitely a bug. However, I'd recommend using this workaround for now.

Here is how I use bazel-embedded to generate separate elfs/binaries.

The way that I do things is just to use the elf, or if I need the raw binary I just use the stripped target e.g. If I have the following build definition;

cc_binary(
    name = "main",
    srcs = ["main.cc"],
)

To get the elf file I run something like this (it won't have the .elf extension unless you name the cc_binary 'main.elf');
bazel build //:main --platforms=@bazel_embedded//platforms:cortex_m4_fpu

However, if I want the binary file I use the stripped sub-target which is configured to strip all ELF sections leaving the binary e.g.

bazel build //:main.stripped --platforms=@bazel_embedded//platforms:cortex_m4_fpu

You can use strip or objcopy to achieve the same result in this case.

from bazel-embedded.

gbalke avatar gbalke commented on September 20, 2024

I think the main concern is keeping the build and debug symbols in the same step. If the binary is generated in a separate build step than the elf, there may be issues when going to debug via gdb. I'd rather have this copy step. I think fixing the definition here is probably the right way to do it. I'll see if I can submit a fix.

from bazel-embedded.

silvergasp avatar silvergasp commented on September 20, 2024

Yeah technically they are preserved e.g. it already looks like elf->stripped. So if you go elf(with embedded debug dwarf section)->stripped it'll still produce the same binary minus the elf headers and dwarf sections. But in any case that PR looks fine, and is fixing what I would consider a bug.

from bazel-embedded.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.