-
Notifications
You must be signed in to change notification settings - Fork 178
Create detailed custom-target-porting.md #1145
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
Conversation
852b131
to
d3e07c0
Compare
@iriark01 for review |
Push up initial copy edits.
@arekzaluski and @sophewilliams I understand you did a lot of work on this topic - would you like to review this? |
This doc is really good - what do we need to merge it for 5.14? |
This is still a work in progress and will not make it to 5.14; code freeze has already happened, OOB has started and the release is in six days. |
Note this is not based on any new feature and doesn't depend on OOB. It's based on knowledge gaps we have in our docs. |
|
||
When designing a custom board based on an existing Mbed Enabled board, you may need to make configuration and software changes to adapt Mbed OS to run on your new board. This is called a software port. The necessary changes may include adaptations for the unique design choices you have made for your new board, such as clocking, pin connections and peripheral usage. This can often be accomplished by adding configuration and source files to an Mbed OS-based application project without the need to modify files within `mbed-os`, itself. If you don't plan to push your changes to the upstream `mbed-os` repository, this simplifies your software configuration management by allowing you to keep your new files separate. | ||
|
||
Mbed OS supports target inheritance, which allows you to extend an existing microcontroller (MCU) target and just add software and configurations required for your board. You have the ability to add a file named `custom_target.json` to your project, which can store your custom target configurations without the need to modify `targets.json`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not clear on the break and order of information in the first two paragraphs.
|
||
When designing a custom board based on an existing Mbed Enabled board, you may need to make configuration and software changes to adapt Mbed OS to run on your new board. This is called a software port. The necessary changes may include adaptations for the unique design choices you have made for your new board, such as clocking, pin connections and peripheral usage. This can often be accomplished by adding configuration and source files to an Mbed OS-based application project without the need to modify files within `mbed-os`, itself. If you don't plan to push your changes to the upstream `mbed-os` repository, this simplifies your software configuration management by allowing you to keep your new files separate. | ||
|
||
Mbed OS supports target inheritance, which allows you to extend an existing microcontroller (MCU) target and just add software and configurations required for your board. You have the ability to add a file named `custom_target.json` to your project, which can store your custom target configurations without the need to modify `targets.json`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mbed OS supports target inheritance, which allows you to extend an existing microcontroller (MCU) target and just add software and configurations required for your board. You have the ability to add a file named `custom_target.json` to your project, which can store your custom target configurations without the need to modify `targets.json`. | |
Mbed OS supports target inheritance, which allows you to extend an existing microcontroller (MCU) target and just add software and configurations required for your board. You can add a file named `custom_target.json` to your project, which can store your custom target configurations without the need to modify `targets.json`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this sentence assumes I know what targets.json is; might be nice to link to information about it, or any other information we want people to have before they try this tutorial (the assumption may be correct for our readers - I'm just pointing it out)
|
||
## Extending an existing MCU target configuration | ||
|
||
As an example, consider a situation in which you are creating a new board based on an existing Mbed Enabled board. For this tutorial, consider a new board called `ImaginaryBoard` that is based on [DISCO-L475VG-IOT01A](https://os.mbed.com/platforms/ST-Discovery-L475E-IOT01A/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that an example, or just the premise of this whole document?
|
||
1. Create a new file named `custom_targets.json` at the same level as the `mbed-os` directory: | ||
|
||
Inspect the contents of `mbed-os/targets/targets.json`. For this example, search for `DISCO_L475VG_IOT01A`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like a new step.
|
||
You can test this simple example using a `DISCO-L475VG-IOT01A`. If you actually created a `ImaginaryBoard` board, you could use that too. | ||
|
||
<span class="notes">**Note:** Unless your board has an Mbed Enabled debug interface, you need a method of flashing the memory on your board. </span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this come earlier?
|
||
<span class="notes">**Note:** Unless your board has an Mbed Enabled debug interface, you need a method of flashing the memory on your board. </span> | ||
|
||
Since the `DISCO-L475VG-IOT01A` has a Mbed Enabled debug interface (STLink in this case), we can use drag-and-drop programming to flash the board. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the `DISCO-L475VG-IOT01A` has a Mbed Enabled debug interface (STLink in this case), we can use drag-and-drop programming to flash the board. | |
Since the `DISCO-L475VG-IOT01A` has an Mbed Enabled debug interface (STLink in this case), we can use drag-and-drop programming to flash the board. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we flipping a bit between "We" and "You"?
|
||
Locate the binary file and drag it onto the disk drive name for the board (for example, `DIS_L4IOT`). | ||
|
||
After the file transfer is complete, press the reset button on the board. You should see the LED blinking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the file transfer is complete, press the reset button on the board. You should see the LED blinking. | |
When the file transfer is complete, press the reset button on the board. You should see the LED blinking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New step
|
||
After the file transfer is complete, press the reset button on the board. You should see the LED blinking. | ||
|
||
1. (Optional) Run automated tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe new header?
mbed test -m IMAGINARYBOARD -t <toolchain> | ||
``` | ||
|
||
The tests should start running. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we link to some information about testing?
Co-Authored-By: Irit Arkin <[email protected]>
Co-Authored-By: Irit Arkin <[email protected]>
Co-Authored-By: Irit Arkin <[email protected]>
Co-Authored-By: Irit Arkin <[email protected]>
Co-Authored-By: Irit Arkin <[email protected]>
Co-Authored-By: Irit Arkin <[email protected]>
Co-Authored-By: Irit Arkin <[email protected]>
Co-Authored-By: Irit Arkin <[email protected]>
Edit file, mostly for active voice, consistent headings, use of numbered lists and to address comments.
@iriark01 Could you please review again? |
@arekzaluski @sophewilliams Would y'all like to review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, I would just add some more details and considerations around the detect code.
#### Changes | ||
|
||
1. The board name changed from `DISCO_L475VG_IOT01A` to `IMAGINARYBOARD`, so the board can be uniquely identified. | ||
1. The `detect_code` changed from `0764` to `1234`. The `detect_code` is a unique number that identifies the board to the Mbed OS test tools. For Mbed Enabled boards, this number is exposed through the debug interface with Mbed CLI by typing `mbedls`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need some information how to set it? When do you need to get it from us and when it's ok to just pick some? How to avoid clashes? Consideration based on public vs private port? I guess it deserves a link to a separate doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking through our documentation - I see it mentioned a few times, but never really see it explained well and the terminology is inconsistent.
- Sometimes its called a board id (https://www.mbed.com/en/about-mbed/mbed-enabled/requirements/).
- Sometimes it is called four-digit hexadecimal identifier (https://os.mbed.com/docs/mbed-os/v5.14/porting/mbed-ls.html)
- Sometimes its called a Platform ID (https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-ls#adding-platform-support).
- Sometimes its called unique board ID (https://os.mbed.com/docs/mbed-os/v5.14/porting/setting-up.html)
- Sometimes its called detect_code (https://github.com/ARMmbed/mbed-os/blob/master/targets/targets.json)
I like Board ID, but Platform ID or the others seem fine.
For me the key points are:
- Board IDs are unique identifiers assigned by the Arm Mbed team.
- Board IDs are used by the Mbed tools to identify the connected board.
- You really only need your own unique ID if you plan to push your platform to the Mbed community.
- You can make Mbed CLI recognize your own custom board even without getting your own Board ID.
- Contact a technical account manger or Mbed support if you would like to request a board ID.
@AnotherButler - can you recommend where this information would be best located?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just added a new commit for this PR with changes related to the Platform ID. Also, I made pull request #1175 to align the terminology and add more detail. Please let me know if this addresses the comments.
@maclobdell Can you make these changes requested by @bulislaw ? |
Thanks for the updates, @maclobdell This is failing Circle CI because of something unrelated. Could you please rebase, and then I'll merge? If you'd rather, I can close this PR and make these changes directly. |
Add content from PR #1145 to fix merge conflict.
Closing in favor of 6be8ae4 |
Add tutorial about porting Mbed OS to a custom board.
This replaces #1130.
Due to difficulty rebasing the previous PR, I went ahead and created a new one.
I rewrote the document based on feedback received. My goal was to provide more clarity and helpful details.
There might be formatting issues. Pleases review and let me know what I should fix.