-
Notifications
You must be signed in to change notification settings - Fork 7.3k
arch/arm/soc/nxp_imx: added support to imx7d m4 core #5330
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
board/colibri_imx7d_m4: added board support to toradex colibri imx7d single board computer This change basically adds support of a popular IMX7D processors from NXP, which has a ARM Cortex A7 Core and a Cortex M4 Core, this change is targeted to the second one and now is possible to select it as a supported SoC, Toradex has some attractive single board computers with industrial grade using this processor and this change also the basic support of the board and the NXP supplied HAL. This support is intended to increase the options of heterogeneous processors in Zephyr SoC portfolio, adds the SoC and Board template is the first step only, so I divided the change in two steps, first provide a functional SoC support to perform build and image generation to be flashed to TCMRAM (imx7d m4 core does not has built in flash), the next step is to provide the serial drivers and the IPM driver to communicate m4 core with a7 core, this approach was chosen to keep the changes not too large and hard to verify. This changed was validated as follows: - built the hello world sample under build folder with: $cmake -DBOARD=colibri_imx7d_m4 .. and make. - the generated image can be loaded through a Jlink probe or with A7 running Linux + uBoot using the fatload command Signed-off-by: Felipe Neves <[email protected]>
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 you split this into at least 2 patches, one for the soc code and one for the board.
Hi, yes I can. In this case I will modify this patch and the next one include board support. Thanks |
@uLipe : Note that you can just make this pull request contain 2 commits (no need to create 2 pull requests for that). |
@pfalcon, thanks for the tip, I will submit the just one PR containing the soc and board commits. Best :) |
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.
Hi @uLipe , thanks for the PR! This is something we have wanted to do for some time.
As others have already said, please split this up into multiple commits as it will help with the review process and keep the git history clean. It's ok to force push your branch to update the PR. I think you should have three commits, rather than two:
- Import mcux hal for imx7d. Please reuse the existing ext/hal/nxp/mcux folder and configs rather than creating a new folder and configs.
- Add imx7d SoC support
- Add colibri board support. Please also add a board doc to this commit, refer to boards/arm/mimxrt1050_evk/doc/mimxrt1050_evk.rst as an example.
cc: @MarekNovakNXP
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. |
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.
Replace with SPDX header as in other files
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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.
In general, we need to keep MCUXpresso SDK files in ext/ only. For this particular case, I think it makes more sense to reimplement the board pinmuxing; see boards/mimxrt1050_evk/pinmux.c for an example.
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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.
Replace with SPDX Apache header
CONFIG_CONSOLE=y | ||
CONFIG_CONSOLE_HAS_DRIVER=y | ||
CONFIG_UART_CONSOLE=y | ||
CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_2" |
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.
Remove this line, the uart dev comes from the board dts
CONFIG_SOC_MCIMX7_M4=y | ||
CONFIG_BOARD_COLIBRI_IMX7D_M4=y | ||
CONFIG_CORTEX_M_SYSTICK=y | ||
CONFIG_UART_NXP_IMX=y |
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.
Remove this line, we can select the appropriate uart driver in the SoC defconfig. See arch/arm/soc/nxp_imx/rt/Kconfig.defconfig.mimxrt1052 for an example.
|
||
soc { | ||
|
||
tcram: tcram@1fff8000 { |
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.
Let's call this tcml to match the hardware reference manual, and add tcmu.
ddram: ddram@10000000 { | ||
compatible = "nxp,imx-ddram"; | ||
reg = <0x10000000 0x10000000>; | ||
label = "CCM"; |
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.
s/CCM/DDR/
|
||
uart2: uart@30890000 { | ||
compatible = "nxp,imx-uart"; | ||
reg = <0x30890000 0x4000>; |
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.
Base address should be 0x30870000
@@ -20,6 +20,8 @@ source "ext/hal/nordic/Kconfig" | |||
|
|||
source "ext/hal/nxp/mcux/Kconfig" | |||
|
|||
source "ext/hal/nxp/imx/Kconfig" |
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.
Merge contents into existing ext/hal/nxp/mcux
@MaureenHelm , thanks for the tips I started to work in these changes, let me ask a question about the mcux hal and imx hal, I noted the nxp sdk for the IMX7 microcontroller side seems to not compatible with the new mcuxpresso drivers (the files are quite different and the IPs too), more than that currently the MCUX dashboard does not support the imx7d processors, the duplication of the hal was based on this incompatibility, but I agree with you to keep only the mcux hal. Given this scenario the question is: Can I move the drivers source files of IMX7 directly to the mcuexpresso drivers/ directory? or should I create a second directory called for example: drivers_imx7d ? |
My mistake, I thought we had imx7d m4 support in mcux 2.x but it turns out the drivers and headers are based on ksdk 1.x. Let me check with the internal development team to see if there are any plans to update it, and then we can decide how to proceed. |
@MaureenHelm curious if the imx7d and imx6 code would be similar (for those imx6 devices with cortex-m as well). |
For now, yes. Existing imx6 and imx7 devices have similar ksdk 1.x based m4 drivers, but future devices in these families may have mcux 2.x.
There are no plans to update this device to mcux 2.x, so I now agree with your original decision to create a new hal folder. I'm not sure I like "ext/hal/nxp/imx" and CONFIG_HAS_IMX_HAL though, as I think that will create confusion for imx devices that do have mcux. NXP releases the code in a "FreeRTOS BSP", which is based on ksdk 1.x, so some possible alternatives are: Thoughts? |
@@ -7,6 +7,7 @@ | |||
*.swp | |||
*.swo | |||
*~ | |||
*.DS_Store |
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 really sure we should be adding this, and if it should be in a separate PR/commit.
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.
Remove the .bin.inc files that are checked in.
@@ -0,0 +1,273 @@ | |||
0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, |
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 file should not be check in.
Hi, @MaureenHelm, thanks for the support, I agree the imx named folder in hal could cause confusion, ksdk seems confusing too since it refers to the old kinetis sdk. freertos_bsp is also too generic but since it will contained in nxp folder, this can be a solution. Should i proceed with hal/nxp/freertos_sdk(or bsp)? Thanks again :) |
Do you expect that something like i.mx8 would be supported by mcux? I wondering if we should just have native drivers. Wondering how many peripheral drivers would actually be used/supported? @uLipe which devices do you see using from the Cortex-M4 on i.mx7d? |
Yes
Why? We still need the device headers, so doing native drivers doesn't eliminate the problem of how to import the nxp freertos bsp.
I think we should go with freertos_bsp. It's a little weird, but it's closest to the package name from nxp. @galak, do you agree? |
Uugh, why'd you guys have to use freertos in the bsp name ;). Could we do something like ext/hal/nxp/imx_legacy/ or 'imx_6_7' or something like that to convey the SoCs we are supporting? |
No, there may be new SoCs in these families that have mcux. I don't like having freertos in the name either, but I still think keeping the folder name close to the nxp package name makes the origin clear. |
@uLipe - any feedback to my question? |
Hello all, sorry for long delayed response (I was travelling with very limited internet access). Regarding the question, @galak , I don't think the mention of freertos is the more correct way, but based on sdk delivered by NXP and if the goal is to make the external resources on hal folder compliant with the chip manufacturer, the freertos_bsp is the better way to naming,using imx_legacy is not good at all too because IMX6 and 7 families as well their sdk are not obsolete, discontinued or even legacy, is just not compatible with the current mcux sdk. I used the name as just "imx" because it sounds a mid-term but at cost of some confusion risk by the user, @MaureenHelm can I keep the naming of the original PR? I think, because mcux incompatibility by the IMX7 SoCs, the naming solution chosen will aways have a drawback. I will resume the PR task at this weekend. Thanks again by the support. Felipe |
@uLipe any chance you'll get back to this? |
Hello @galak , I will suffering some busy times here and due this I will not be able to continue it, my colleague @diegosueiro will take this task from ahead. Thanks for the support |
Yes
Understand. Thanks @diegosueiro for picking this up. |
It will be a pleasure to continue this PR. I'm just wondering if it is better to create a new PR applying the changes suggested by you and @galak. I'm just confused regarding the naming the hal directory. What should I use? "ext/hal/nxp/imx"? |
Either way is fine. We usually do force pushes to update a PR, but in this case you would have to force push to @uLipe 's repo. If you do create a new PR, please add a reference to this one in the description.
Yes, sorry for the confusion. I don't really like this name or any of the others we kicked around, but I don't have any better suggestions. Please also have a look at http://docs.zephyrproject.org/contribute/contribute_non-apache.html |
Got it. I'll create a new PR.
The iMX7D drivers and utilities were taken from NXP FreeRTOS BSP and according to the file "SW-Content-Register-FreeRTOS-BSP-1.0.1-i.MX7D.txt" they are released under BSD-3-Clause. In this case, should I need to make the submission for TSC review? |
Please add a README to your PR, and I'll submit it to the TSC/gov board for review. |
Just to let you know that I just submitted the PR #6367 |
Thanks! |
board/colibri_imx7d_m4: added board support to toradex colibri imx7d single board computer
This change basically adds support of a popular IMX7D processors from NXP, which has a ARM Cortex A7 Core and a Cortex M4 Core, this change is targeted to the second one and now is possible to select it as a supported SoC, Toradex has some attractive single board computers with industrial grade using this processor and this change also the basic support of the board and the NXP supplied HAL.
This support is intended to increase the options of heterogeneous processors in Zephyr SoC portfolio, adds the SoC and Board template is the first step only, so I divided the change in two steps, first provide a functional SoC support to perform build and image generation to be flashed to TCMRAM (imx7d m4 core does not has built in flash), the next step is to provide the serial drivers and the IPM driver to communicate m4 core with a7 core, this approach was chosen to keep the changes not too large and hard to verify.
This changed was validated as follows:
Signed-off-by: Felipe Neves [email protected]