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

Bootloader overrides from config are not processed #156

Open
1 of 2 tasks
rwalton-arm opened this issue Dec 11, 2020 · 27 comments
Open
1 of 2 tasks

Bootloader overrides from config are not processed #156

rwalton-arm opened this issue Dec 11, 2020 · 27 comments
Labels
bug Something isn't working

Comments

@rwalton-arm
Copy link
Contributor

rwalton-arm commented Dec 11, 2020

Description

mbed_app_start and friends are not processed by the config tool.

Issue request type

  • Enhancement
  • Bug
@ghost
Copy link

ghost commented Dec 12, 2020

does mbed_app_start and friends work yet?

@rwalton-arm
Copy link
Contributor Author

does mbed_app_start and friends work yet?

Sorry, the "bootloader overrides" don't work yet. We do have another backlog item to add those in. We will get to that over the next few weeks.

@ladislas
Copy link
Contributor

@rwalton-arm looking forward to the bootloader settings. It is really needed for our product. We are a bit lost in translation as we are moving to the new CMake build system but need a way to manage the bootloader and application (we are using Pelion)

@rwalton-arm rwalton-arm changed the title Some target settings defined in targets.json cannot be modified from config Bootloader overrides from config are not processed Jan 19, 2021
@Patater Patater added the bug Something isn't working label Jan 26, 2021
@boraozgen
Copy link

This is blocking adoption for us. How much effort would this require to be implemented?

@0xc0170
Copy link
Contributor

0xc0170 commented May 3, 2021

@boraozgen #270 - this does not fix the issue? If not, what we are missing? Can you describe what is blocking your project?

@boraozgen
Copy link

We are using a bootloader with an application. Therefore it is required to shift the application in ROM. Here it is explained that target.mbed_app_start and target.mbed_app_size can be used to do this, and indeed that is what I use with CLI 1. These options are not yet supported in CLI 2.

I see that #270 adds support for mbed_rom_start and mbed_rom_size, which seem to be doing the same thing, but I'm not sure. I'll try them out.

@ghost
Copy link

ghost commented May 19, 2021

as far as i can tell it's not quite ready yet. I'm still looking for a way to work around it without editing the ld file itself.

This in particular doesn't work since it doesn't seem to parse from target_overrides:

{
  "target_overrides": {
    "*": {
      "mbed_app_start": "0xA",
      "mbed_app_size: "0xB"
    }
  }
}

@boraozgen
Copy link

boraozgen commented May 19, 2021

I tried it today too, like @jrobeson said it does not parse the inputs from mbed_app.json.

{
    "target_overrides": {
        "*": {
            "target.mbed_rom_start": "0x8020200",
            "target.mbed_rom_size": "0xBE000"
        }
    }
}

This does not change anything in mbed_config.cmake. Furthermore I noticed that invalid configurations are not detected in mbed_app.json, but that's another issue.

@ladislas
Copy link
Contributor

hitting the same issue working on mcuboot.

@ghost
Copy link

ghost commented May 20, 2021

I thought i'd post the actual error from mbed-tools now that i found it again:

WARNING: You are attempting to override an undefined config parameter `target.mbed_app_start`.
It is an error to override an undefined configuration parameter. Please check your target_overrides are correct.
The parameter `target.mbed_app_start` will not be added to the configuration.
WARNING: You are attempting to override an undefined config parameter `target.mbed_app_size`.
It is an error to override an undefined configuration parameter. Please check your target_overrides are correct.
The parameter `target.mbed_app_size` will not be added to the configuration.

@rwalton-arm
Copy link
Contributor Author

rwalton-arm commented May 20, 2021

Could you let us know which targets you're working with? I'd guess the parameters aren't defined in targets.json for the target(s) so the tool doesn't want to apply an override. mbed-cli used to rely on another JSON file from CMSIS pack manager to get this information, but we decided the best approach was to move everything to targets.json as the CMSIS pack manager index file wasn't maintained and in some cases conflicted with the definitions in targets.json.

@ghost
Copy link

ghost commented May 20, 2021

ah, i see the problem then. For me it's the nrf52832 and nrf52840 chips and various boards based on them with a custom bootloader.

@boraozgen
Copy link

boraozgen commented May 20, 2021

STM32F4 based custom targets and dev boards (e.g. NUCLEO_F429ZI).

I just modified targets.json to define mbed_rom_start and mbed_rom_size for my target, and indeed the compiler flags appeared in mbed_config.cmake. However I cannot override them in mbed_app.json. What is the syntax for it?

@ladislas
Copy link
Contributor

we decided the best approach was to move everything to targets.json

@rwalton-arm do you want to handle that PR by PR as they come or does it need to be 1 big PR to rule them all?

@ladislas
Copy link
Contributor

Could you let us know which targets you're working with?

@rwalton-arm STM32F769 custom target based on DISCO_F769.

@rwalton-arm
Copy link
Contributor Author

However I cannot override them in mbed_app.json. What is the syntax for it?

Your syntax above looked correct. I've just tried it myself and I can reproduce the issue. Looks like a bug in the memory region collection.

@rwalton-arm
Copy link
Contributor Author

we decided the best approach was to move everything to targets.json

@rwalton-arm do you want to handle that PR by PR as they come or does it need to be 1 big PR to rule them all?

PR by PR would be easier to review, but I guess one PR to rule them all would also work.

@ladislas
Copy link
Contributor

We've just tried this, and it seems to be working in our case:

{
    "config": {
        "mbed_app_start": {
            "help": "Use a custom application start address",
            "value": "0x08020000",
            "macro_name": "MBED_APP_START"
        }
    },
    "target_overrides": {
        "*": {
            "platform.stdio-baud-rate": 115200,
        }
    }
}

@boraozgen
Copy link

@ladislas this generates the flags in mbed_config.cmake but does not seem to shift the image. A quick search for MBED_CONFIG_DEFINITIONS shows that these flags are not given to the linker. I'm on 6.9.0, don't know if this changed in 6.10.

@ladislas
Copy link
Contributor

we are on 6.9 as well. have you made a deep clean before building?
are you using a custom target? (we are)

@boraozgen
Copy link

Deep clean did it, don't know why though. Not a good sign IMHO :/

Nice workaround, thanks!

@ladislas
Copy link
Contributor

ladislas commented May 20, 2021

Great! My team mate @YannLocatelli is the real hero here 🙏

@kalle16lab
Copy link

Hi! The workaround mentioned by @ladislas woks but I am also currently interested in switching to CLI2 from Mbed Studio and this is also blocking progress on a commercial project.

Any ETA on a pull request to master to fix this?

@ghost
Copy link

ghost commented May 21, 2021

@kalle16lab If it's a commercial project, then seems like you should be to able assist right?

@ladislas
Copy link
Contributor

@kalle16lab we are not using mbed studio but mbed cli2

@nat45928
Copy link

I hit this today as well and had to use @ladislas workaround.

Are there plans to get these features pulled into mbed-tools?

ccli8 added a commit to ccli8/NuMaker-mbed-AWS-IoT-CSDK-OTA-example that referenced this issue Jul 13, 2022
1.  Support MCUboot
    -   Relevant file list at bootloader/MCUboot
        -   Prebuilt bootloader binary "mbed-mcuboot-bootloader_xxx"
        -   Compatible private key "signing-keys.pem" for signing built application binary
        -   Public key "signing_keys.c" for mcuboot compile
    -   Work around MCUBOOT_HAVE_LOGGING missing in mbed port's mcuboot_config.h
    -   Change log level to 'INFO'
    -   Secondary slot at internal flash (FLASHIAP)
    -   Update mbed-client-for-aws.lib to enable AWS OTA PAL for MCUboot
    NOTE: mbed-mcuboot-demo build target NUMAKER_IOT_M467_FLASHIAP
    NOTE: MCUboot configuration must be consistent with mbed-mcuboot-demo.
    NOTE: Mbed CLI 2 doesn't support locating application to another address. Use Mbed CLI 1 instead. See:
          ARMmbed/mbed-tools#156
2.  Support WiFi as default network type
3.  Update readme
4.  Direct mbed-os.lib to m467 branch temporarily.
    Use of target name 'NUMAKER_IOT_M467' will cause build failure because it hasn't yet added into mainline.
ccli8 added a commit to ccli8/NuMaker-mbed-AWS-IoT-CSDK-OTA-example that referenced this issue Jul 15, 2022
1.  Support MCUboot
    -   Relevant file list at bootloader/MCUboot
        -   Prebuilt bootloader binary "mbed-mcuboot-bootloader_xxx"
        -   Compatible private key "signing-keys.pem" for signing built application binary
        -   Public key "signing_keys.c" for mcuboot compile
    -   Work around MCUBOOT_HAVE_LOGGING missing in mbed port's mcuboot_config.h
    -   Change log level to 'INFO'
    -   Secondary slot at internal flash (FLASHIAP)
    -   Update mbed-client-for-aws.lib to enable AWS OTA PAL for MCUboot
    NOTE: mbed-mcuboot-demo build target NUMAKER_IOT_M467_FLASHIAP
    NOTE: MCUboot configuration must be consistent with mbed-mcuboot-demo.
    NOTE: Mbed CLI 2 doesn't support locating application to another address. Use Mbed CLI 1 instead. See:
          ARMmbed/mbed-tools#156
2.  Support WiFi as default network type
3.  Update readme
4.  Direct mbed-os.lib to m467 branch temporarily.
    Use of target name 'NUMAKER_IOT_M467' will cause build failure because it hasn't yet added into mainline.
ccli8 added a commit to OpenNuvoton/NuMaker-mbed-AWS-IoT-CSDK-OTA-example that referenced this issue Jul 26, 2022
1.  Support MCUboot
    -   Relevant file list at bootloader/MCUboot
        -   Prebuilt bootloader binary "mbed-mcuboot-bootloader_xxx"
        -   Compatible private key "signing-keys.pem" for signing built application binary
        -   Public key "signing_keys.c" for mcuboot compile
    -   Work around MCUBOOT_HAVE_LOGGING missing in mbed port's mcuboot_config.h
    -   Change log level to 'INFO'
    -   Secondary slot at internal flash (FLASHIAP)
    -   Update mbed-client-for-aws.lib to enable AWS OTA PAL for MCUboot
    NOTE: mbed-mcuboot-demo build target NUMAKER_IOT_M467_FLASHIAP
    NOTE: MCUboot configuration must be consistent with mbed-mcuboot-demo.
    NOTE: Mbed CLI 2 doesn't support locating application to another address. Use Mbed CLI 1 instead. See:
          ARMmbed/mbed-tools#156
2.  Support WiFi as default network type
3.  Update readme
4.  Direct mbed-os.lib to m467 branch temporarily.
    Use of target name 'NUMAKER_IOT_M467' will cause build failure because it hasn't yet added into mainline.
@rjhind
Copy link

rjhind commented Sep 8, 2023

Just looking to put a boot loader on my Nucleo F411 which is now running mbed and hitting this issue. The work-around for an unmanaged boot loader posted above works for offsetting the app address.

Is there a way to make use of the built-in header with this work-around or do we need to manually place the header also?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants