7 years, 7 months ago.

gnuarmeclipse and post_binary_hook

Does the exporter for gnuarmeclipse use the post_binary_hook? From what I can tell it doesn't.

The main reason I ask is that this is causing the LPC1768 target to be rejected by the exporter.

What I'm seeing is this:

In mbed-os/tools/export/gnuarmeclipse/__init__.py:

POST_BINARY_WHITELIST = set([
    "TEENSY3_1Code.binary_hook",
    "MCU_NRF51Code.binary_hook",
])

In mbed-os/targets/targets.json, LPC1768 inherits from LPCTarget:

    "LPCTarget": {
        "inherits": ["Target"],
        "post_binary_hook": {"function": "LPCTargetCode.lpc_patch"},
        "public": false
    },

Since the LPC settings are omitted from POST_BINARY_WHITELIST, the LPC1768 target is rejected by the gnuarmeclipse exporter.

My silly workaround for this is to either delete or rename the post_binary_hook from the LPCTarget (I rename it to 'no_post_binary_hook').

My workaround works fine until I debug from eclipse using OpenOCD. Even then it is not so bad. Eclipse is using the gdb load command to copy the binary to the device. As OpenOCD sees this passing through, it issues a warning likely related to 32.3.1.1 Criterion for Valid User Code from the NXP LPC1768 User Manual:

"Warn : Verification will fail since checksum in image (0x00000000) to be written to flash is different from calculated vector checksum (0xefff70e6)."
"Warn : To remove this warning modify build tools on developer PC to inject correct LPC vector checksum."

This seems harmless and I can still debug. So,for now, I can ignore this warning. But, I'm curious what might be done to the gnuarmeclipse exporter to patch the binary as is done in https://github.com/ARMmbed/mbed-os/blob/master/tools/patch.py?

For example, maybe:

  • Modify patch.py to take a binary as a command line argument
  • Add a postannouncebuildStep to .cproject to call patch.py

If this seems valid, I can raise an issue, work on it, and submit a pull request. It will obviously snowball into supporting any kind of post binary hook listed in POST_BINARY_WHITELIST.

Will

PS - Many thanks to Liviu Ionescu for his work on GNU ARM Eclipse. Great docs and quite complete. Very useful to me.

I have opened https://github.com/ARMmbed/mbed-cli/issues/468 for this.

posted by Willie Walker 30 Mar 2017
Be the first to answer this question.