Skip to content

Add content from PR #619 #625

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

Closed
wants to merge 9 commits into from
Closed

Conversation

AnotherButler
Copy link
Contributor

Add content to this page, so all porting target content is in one place.

Add content to this page, so all porting target content is in one place.
@jen3andruska
Copy link
Contributor

@AnotherButler Finished reviewing & copy-editing.

Copy link
Contributor

@ashok-rao ashok-rao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @AnotherButler : I've added some comments.

1. Implement APIs, HAL, the system clock configuration and any other additional clocks.
1. Add toolchain-specific linker descriptions.
1. Add peripherals and pin names for the target.
1. Compile with CLI on a supported compiler.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLI -> Mbed CLI

- Add a scatter file, with the extension `.sct`, for Arm Compiler 5.
- Add a linker script, with the extension `.ld`, for GCC Arm Embedded.
- Add an IAR Linker file, with the extension `.icf`, for IAR EWARM.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AnotherButler : Can you please add: "You will also need to add the startup codes (*.s) in the respective directories as well for ARMCC, GCC and IAR."

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashok-rao There is no reason that startup code has to be assembly, and that startup code cannot be shared between compilers. Assembly must have a capitol .S suffix.

### Compiling with a supported compiler

You can verify that the new board port compiles by using an [example application](/docs/development/tutorials/mbed-os-quick-start.html), and checking out the branch containing your port in the `mbed-os` subdirectory.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AnotherButler : Can you please add: "With the Mbed CLI, the command to use in the example's root directory is: mbed compile -t -m <YOUR_NEW_TARGET's_NAME> -c . And if you face any build errors at this point, please add any missing headers, add/remove peripherals as required, ensure the linker scripts & startup code are in place. For simplicity, you can start with only the serial peripheral and add other peripherals once the Mbed OS port builds successfully."

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AnotherButler, @ashok-rao Don't add the -c it's not needed.

Copy link
Member

@bulislaw bulislaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that's a mix of things that don't work together. It's good stuff, but needs a lot of logical changes to make sense. Original cloud porting docs was focusing on something else and it doesn't fit what generic target porting guide should describe. Also I think we have details of some of these things on different pages. Unfortunately i won't be able to look into it soon and the team is fully (and over) committed with deliverables for 5.10 so I can't really pull someone to look at that right now.


First fork the `mbed-os` repository on GitHub into your own user account. We will use the placeholder `USERNAME` to refer to your username in the following documentation, `MCU_NAME` to refer to the new microcontroller you are adding and `BOARD_NAME` to refer to the new board you are adding. Import an Mbed OS example, and add your fork of `mbed-os` using:
[Mbed Cloud Client](https://cloud.mbed.com/docs/current) provides reference implementation for three Mbed Enabled targets: the K64F, NUCLEO_F429ZI and the UBLOX_EVK_ODIN_W2. You do not need to port Mbed OS or the Cloud Client if you are using one of these three boards.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not related to porting for Mbed OS (it's mbed cloud client only) and should be moved elsewhere.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theotherjimmy :This is coming from the Cloud Client porting. There will be a section in the Cloud docs as well that points to this porting guide (correct?? @jen3andruska ). This is intended for folks who plan to (ultimately) port Cloud Client, but need Mbed OS running on their custom platform in the first place. Once they have Mbed OS running on their custom platform, users will link back to Cloud docs for the "rest" of the MCC porting (@AnotherButler : can you link to the MCC porting doc from here that @jen3andruska is working on?). This doc creates a bridge between Cloud porting and OS porting - which are both required for a custom platform.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashok-rao I dont' think that it's worded well if that's the case.


I also think that linking from the mbed-os docs to the cloud docs implies that to get mbed-os support you also need cloud support. I think it has much more potential to do harm in this way than it has the potential to do good by helping those porting cloud.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to agree with @theotherjimmy. I'm not sure why we need to mention the fact that MCC implements porting for k64f or other platforms here. This is a document about porting Mbed-OS and I don't think we need to mention MCC ports available for Mbed-OS, it actually confuses me to read that in introduction. What I would suggest is create a section named "Related Links or Other reference" and may be we can capture things like "Also look into... MCC ports, HAL porting guides".

1. Add your target port.
1. Create the directory structure.
1. Add an entry for the target in `mbed_rtx.h`.
1. Add startup code, CMSIS headers, NVIC headers and **all** relevant drivers from the CMSIS specifications.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a bold "all" here does anyone any good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @theotherjimmy


### Adding a new microcontroller and board

First fork the `mbed-os` repository. This example uses the placeholder `USERNAME` to refer to your username in the following documentation, `MCU_NAME` to refer to the new microcontroller you are adding and `BOARD_NAME` to refer to the new board you are adding. Import an Mbed OS example, and add your fork of `mbed-os` using:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"your username" -> "your github username"

Without that we could be refering to os.mbed.com or something else.

- Add a scatter file, with the extension `.sct`, for Arm Compiler 5.
- Add a linker script, with the extension `.ld`, for GCC Arm Embedded.
- Add an IAR Linker file, with the extension `.icf`, for IAR EWARM.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashok-rao There is no reason that startup code has to be assembly, and that startup code cannot be shared between compilers. Assembly must have a capitol .S suffix.

@theotherjimmy
Copy link
Contributor

@bulislaw The only cloud related stuff is that single paragraph in the opening. Everything else is strictly Mbed OS.

@AnotherButler AnotherButler requested a review from SenRamakri July 18, 2018 17:39
@AnotherButler
Copy link
Contributor Author

@SenRamakri Could you please review this and make the changes requested by @bulislaw in his absence?


There are many more APIs to implement. You enable the following APIs by adding a `device_has` attribute to the MCU_NAME target definition in `targets.json` and providing an implementation of the API declared in the API header.
There are many more APIs to implement. You enable the following APIs by adding a `device_has` attribute to the `MCU_NAME` target definition in `targets.json`, and providing an implementation of the API declared in the API header.

device_has | API header
-----------------|------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be useful to create a link for each of the below header files to actual files in mbed-os repo. Not a big deal, but would be convenient.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could at least make them a link to their respective porting pages.

1. Add an entry for the target in `mbed_rtx.h`.
1. Add startup code, CMSIS headers, NVIC headers and **all** relevant drivers from the CMSIS specifications.
1. Implement APIs, HAL, the system clock configuration and any other additional clocks.
1. Add toolchain-specific linker descriptions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to mention the HAL tests we have under mbed-os\TESTS\mbed_hal which can be used to verify HAL porting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, a link would be valuable too

- Target build name `MY_BOARD_1`.
- Vendor `MY_VENDOR`, device family `MY_FAMILY` and the device on the board `MY_DEVICE`.
- A Cortex-M4F based core.
- Porting for Mbed OS v5.x, which requires support for Arm Compiler 5, GCC Arm Embedded and IAR EWARM.
Copy link
Contributor

@SenRamakri SenRamakri Jul 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is changing, as we are adding ARMv8M platforms which only need to support ARMC6 for now. So, depending on Core Archicture we may support all of these compilers or ARMC6 only if its ARMv8M based core.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Let's add a line here for v8 only requirements.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that requirement in the right place? Not sure whether you're documenting terminology or requirements

@ashok-rao
Copy link
Contributor

@AnotherButler : Any news on this please? Thanks.

@AnotherButler
Copy link
Contributor Author

@bulislaw Once @ashok-rao addresses the comments from @SenRamakri are you OK with this merging?

└── targets
└── TARGET_MY_VENDOR
├── TARGET_MY_FAMILY
│ ├── TARGET_MY_DEVICE_1
Copy link
Contributor

@0xc0170 0xc0170 Aug 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this tree, I was explaining the structure this week to at least 2 issues regarding not having MCU_ 💯

Can we use TARGET_MCU_DEVICE_1 rather than MY_DEVICE_1 ? Similar to what is mentioned in the directory section above : TARGET_<specific_MCU> . I would keep there MCU word

Copy link
Member

@bulislaw bulislaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left couple of comments, but it's not good. We need to have a proper task on engineering to use useful parts from both docuements rather than merge them. They actually talk about slightly different thing.
@donatieng


Adding a new microcontroller to Arm Mbed OS 5 depends on CMSIS-CORE and CMSIS-Pack. Please make sure that the microcontroller already has these available.
This document discusses requirements for porting Mbed OS to a derivative target of any one of the Mbed Enabled&trade; targets. To port the MCU to Mbed OS as well, along with a custom board based on the MCU, please follow our [more detailed porting guide](docs/development/reference/porting-targets.html).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't make any sense. This document is about porting the MCU... We are trying to merge two pages talking about slightly different thing. Oh and the docs/development/reference/porting-targets.html doesn't exists as far as i can tell.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the confusing part is "To port the MCU to Mbed OS as well, along with a custom board based on the MCU, please follow our more detailed porting guide. " ...

@AnotherButler : Would it be clear if we just mention "To port an MCU itself (rather than a derived target of the MCU), please refer to the detailed porting guide here" ?
Maybe we also need to mention clearly somewhere, what "porting an MCU" vs "porting a derived target" means as well.. before the start of this document.

@theotherjimmy .. thoughts??

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's the "more detailed porting guide"? Also, this page should address porting any new boards/MCU - not just a derivative.


First fork the `mbed-os` repository on GitHub into your own user account. We will use the placeholder `USERNAME` to refer to your username in the following documentation, `MCU_NAME` to refer to the new microcontroller you are adding and `BOARD_NAME` to refer to the new board you are adding. Import an Mbed OS example, and add your fork of `mbed-os` using:
[Mbed Cloud Client](https://cloud.mbed.com/docs/current) provides reference implementation for three Mbed Enabled targets: the K64F, NUCLEO_F429ZI and the UBLOX_EVK_ODIN_W2. You do not need to port Mbed OS or the Cloud Client if you are using one of these three boards.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we mentioning MCC here, we are talking about porting the OS, after the OS is ported we can start porting the MCC.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bulislaw : That's the ultimate goal. In order to reach the top floor (Pelion Cloud Client), we need to clear the ground floor (OS port running successfully on whatever board the customer has) .. and no probs if they use K64 / F429 / ODIN as these are already working in the examples.. however, the problem comes when they use an F429 MCU on a custom PCB (not NUCLEO) or a K64 (not FRDM) or ODIN (not EVK / MTB..) .. this guide should help them get Mbed OS running on those custom boards 1st. Then, they can move to PCC..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not happy with the current wording which is confusing; as said above this page is about porting the OS.
However you could add a note somewhere: "Note: This page describes the porting process of Mbed OS which is a Pelion Cloud Client dependency; to port Cloud Client, go to this page..."


### Summary of steps

1. Add your target to `targets.json`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That assumes cloud porting, not the system.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't a new target needs to be added here anyways for building from CLI ?

@ashok-rao
Copy link
Contributor

@donatieng : I know you are quite occupied with the release, but could you please have a look at this PR? I've addressed previous comments & now that DM is becoming a part of the OS, I feel this doc needs to be absolutely put in place as well.. could you please let me know? Thanks.


Adding a new microcontroller to Arm Mbed OS 5 depends on CMSIS-CORE and CMSIS-Pack. Please make sure that the microcontroller already has these available.
This document discusses requirements for porting Mbed OS to a derivative target of any one of the Mbed Enabled&trade; targets. To port the MCU to Mbed OS as well, along with a custom board based on the MCU, please follow our [more detailed porting guide](docs/development/reference/porting-targets.html).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's the "more detailed porting guide"? Also, this page should address porting any new boards/MCU - not just a derivative.


First fork the `mbed-os` repository on GitHub into your own user account. We will use the placeholder `USERNAME` to refer to your username in the following documentation, `MCU_NAME` to refer to the new microcontroller you are adding and `BOARD_NAME` to refer to the new board you are adding. Import an Mbed OS example, and add your fork of `mbed-os` using:
[Mbed Cloud Client](https://cloud.mbed.com/docs/current) provides reference implementation for three Mbed Enabled targets: the K64F, NUCLEO_F429ZI and the UBLOX_EVK_ODIN_W2. You do not need to port Mbed OS or the Cloud Client if you are using one of these three boards.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not happy with the current wording which is confusing; as said above this page is about porting the OS.
However you could add a note somewhere: "Note: This page describes the porting process of Mbed OS which is a Pelion Cloud Client dependency; to port Cloud Client, go to this page..."

1. Add your target port.
1. Create the directory structure.
1. Add an entry for the target in `mbed_rtx.h`.
1. Add startup code, CMSIS headers, NVIC headers and **all** relevant drivers from the CMSIS specifications.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @theotherjimmy

1. Add an entry for the target in `mbed_rtx.h`.
1. Add startup code, CMSIS headers, NVIC headers and **all** relevant drivers from the CMSIS specifications.
1. Implement APIs, HAL, the system clock configuration and any other additional clocks.
1. Add toolchain-specific linker descriptions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, a link would be valuable too

- Target build name `MY_BOARD_1`.
- Vendor `MY_VENDOR`, device family `MY_FAMILY` and the device on the board `MY_DEVICE`.
- A Cortex-M4F based core.
- Porting for Mbed OS v5.x, which requires support for Arm Compiler 5, GCC Arm Embedded and IAR EWARM.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that requirement in the right place? Not sure whether you're documenting terminology or requirements

First fork the `mbed-os` repository on GitHub into your own user account. We will use the placeholder `USERNAME` to refer to your username in the following documentation, `MCU_NAME` to refer to the new microcontroller you are adding and `BOARD_NAME` to refer to the new board you are adding. Import an Mbed OS example, and add your fork of `mbed-os` using:
[Mbed Cloud Client](https://cloud.mbed.com/docs/current) provides reference implementation for three Mbed Enabled targets: the K64F, NUCLEO_F429ZI and the UBLOX_EVK_ODIN_W2. You do not need to port Mbed OS or the Cloud Client if you are using one of these three boards.

### Summary of steps
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have one clear section per step?

/mbed-os/targets/TARGET_MY_VENDOR/TARGET_MY_FAMILY/TARGET_MY_DEVICE_1/TARGET_MY_BOARD_1/
```

### Entry in `mbed_rtx.h`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks good but shouldn't it go in rtos.md?

@donatieng
Copy link
Contributor

Hi @ashok-rao, I feel this still needs major rework - what is you goal for 5.10 in terms of integrating references to DM? Can we achieve that with a single note such as "this page describes porting a new target to Mbed OS, please find the Cloud Client porting guide here"?

@iriark01
Copy link
Contributor

iriark01 commented Oct 9, 2018

Closing; we're getting new porting content that will also cover this for 5.11

@iriark01 iriark01 closed this Oct 9, 2018
@iriark01 iriark01 deleted the AnotherButler-patch-3 branch October 15, 2018 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants