Skip to content

boards/arm/tiva/tm4c123g-launchpad: add CMakeLists.txt #16195

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

Merged
merged 1 commit into from
Apr 14, 2025

Conversation

roskuttan
Copy link
Contributor

Summary

This commit introduces CMake build support for the TI TM4C123G LaunchPad development board within the NuttX RTOS. It achieves this by adding a CMakeLists.txt file to the boards/arm/tiva/tm4c123g-launchpad & boards/arm/tiva/tm4c123g-launchpad directory. This new file does not introduce CMake support from scratch but rather integrates the existing CMake configurations already present in the arch folders. The primary purpose is to enable building NuttX for this specific board using the CMake build system.

Impact

This change primarily affects the build process for the tm4c123g-launchpad board. Developers who prefer or need to use CMake for their NuttX builds will now have this option for this specific target. It does not remove the existing build system but provides an alternative. This change should not directly impact existing users who continue to use the traditional make build.

Testing

To verify this change, the following steps were taken:

  • Host OS: WSL2 Ubuntu 24.04

  • CPU: Intel Core i5 10th Gen (Hexacore)

  • Target: tm4c123g-launchpad

  • Verification Steps:

    1. Navigated to the root NuttX directory: nuttxspace/nuttx.
    2. Executed the CMake command to configure the build. The exact command used was likely similar to: cmake -B build -DBOARD_CONFIG=tm4c123g-launchpad:nsh -GNinja. Please adjust this command to reflect your exact configuration.
    3. Flashed and run diffrent programs many times without any errors
    4. Verified that the entire NuttX build process completed successfully the tm4c123g-launchpad configuration.

@roskuttan roskuttan changed the title This commit introduces CMake build support for the TI TM4C123G LaunchPad boards/arm/tiva/tm4c123g-launchpad: add CMakeLists.txt Apr 11, 2025
@github-actions github-actions bot added the Size: S The size of the change in this PR is small label Apr 11, 2025
@nuttxpr
Copy link

nuttxpr commented Apr 11, 2025

[Experimental Bot, please feedback here]

Yes, this PR appears to meet the NuttX requirements, although some minor improvements could be made.

Strengths:

  • The summary clearly explains the change, its purpose, and how it works.
  • The impact section addresses key areas and notes the lack of impact on users relying on the existing build system.
  • Testing information includes the host and target details.

Areas for Improvement (to make it even better):

  • Summary: Add a link to the relevant NuttX issue if one exists. Even if this PR doesn't directly address a specific issue, it might be related to ongoing CMake build system improvements. Mentioning this connection can be helpful.
  • Impact: Explicitly state NO for all other impact categories (user, hardware, documentation, security, compatibility) if they truly are not affected. This adds clarity.
  • Testing:
    • The CMake command should be the exact command used. Don't say "likely similar to." Provide the precise command so it's reproducible.
    • "Flashed and ran different programs many times without any errors" is vague. Be specific! Which programs? What functionality was tested? What constituted a successful test? Consider providing snippets of output showing expected behavior. Ideally, the logs before/after wouldn't be empty. While they might not be applicable in all scenarios, if there's any relevant output showing the change's effect, include it. Even a simple "Hello, World" example running successfully via CMake vs. make would be better than nothing.
    • Be explicit about the tools used: "Flashed using OpenOCD (version X.Y.Z)" or similar.

Example of improved testing section:

## Testing

I confirm that changes are verified on the local setup and work as intended:

* **Build Host:** WSL2 Ubuntu 24.04, Intel Core i5 10th Gen (Hexacore), CMake version X.Y.Z, Ninja version A.B.C
* **Target:** `tm4c123g-launchpad`, OpenOCD version P.Q.R

* **Verification Steps:**
    1. Navigated to the root NuttX directory: `nuttxspace/nuttx`.
    2. Executed the following CMake command: `cmake -B build -DBOARD_CONFIG=tm4c123g-launchpad:nsh -GNinja`
    3. Built NuttX: `ninja -C build`
    4. Flashed the built `nuttx.bin` to the tm4c123g-launchpad using OpenOCD:  `openocd -f interface/stlink-v2.cfg -f target/tm4c123gh6pm.cfg -c "program build/nuttx.bin verify reset exit"`  (Replace with your actual OpenOCD command and config files.)
    5. Connected to the board's serial console.
    6. Verified the NSH console started successfully by observing the NSH prompt: `nsh>`
    7. Executed the `hello` command within NSH and observed the expected output: `Hello, World!`

Testing logs after change (NSH interaction):

nsh> hello
Hello, World!
nsh>

By adding this level of detail, reviewers can easily reproduce your testing and have more confidence in the changes.

@lupyuen
Copy link
Member

lupyuen commented Apr 11, 2025

Hi @roskuttan: Please sign off your commit with git commit -s ; git push. Thanks :-)

@acassis
Copy link
Contributor

acassis commented Apr 12, 2025

@roskuttan the CI detected some issues in your CMake file:

ERROR __main__.py:618: Check failed: /home/runner/work/nuttx/nuttx/nuttx/boards/arm/tiva/tm4c123g-launchpad/CMakeLists.txt

cmake-format check failed, run following command to update the style:
  $ cmake-format <src> -o <dst>

ERROR __main__.py:618: Check failed: /home/runner/work/nuttx/nuttx/nuttx/boards/arm/tiva/tm4c123g-launchpad/CMakeLists.txt
ERROR __main__.py:618: Check failed: /home/runner/work/nuttx/nuttx/nuttx/boards/arm/tiva/tm4c123g-launchpad/src/CMakeLists.txt

As suggested you can use:

$ cmake-format CMakelists.txt -o /tmp/CMakelists.txt

The copy this CMake created at /tmp/ over your original CMakelists.txt file

@roskuttan
Copy link
Contributor Author

@roskuttan the CI detected some issues in your CMake file:

ERROR __main__.py:618: Check failed: /home/runner/work/nuttx/nuttx/nuttx/boards/arm/tiva/tm4c123g-launchpad/CMakeLists.txt

cmake-format check failed, run following command to update the style:
  $ cmake-format <src> -o <dst>

ERROR __main__.py:618: Check failed: /home/runner/work/nuttx/nuttx/nuttx/boards/arm/tiva/tm4c123g-launchpad/CMakeLists.txt
ERROR __main__.py:618: Check failed: /home/runner/work/nuttx/nuttx/nuttx/boards/arm/tiva/tm4c123g-launchpad/src/CMakeLists.txt

As suggested you can use:

$ cmake-format CMakelists.txt -o /tmp/CMakelists.txt

The copy this CMake created at /tmp/ over your original CMakelists.txt file

Fixed

@xiaoxiang781216
Copy link
Contributor

@roskuttan please remove the merge patch from PR.

@roskuttan
Copy link
Contributor Author

@roskuttan please remove the merge patch from PR.

What you mean?

@xiaoxiang781216
Copy link
Contributor

@roskuttan please remove the merge patch from PR.

What you mean?

remove this patch:
589019a
you have two patches in this pr:
https://github.com/apache/nuttx/pull/16195/commits
but it should be only one.

@roskuttan roskuttan closed this Apr 14, 2025
@github-actions github-actions bot added Size: XS The size of the change in this PR is very small and removed Size: S The size of the change in this PR is small labels Apr 14, 2025
@roskuttan roskuttan reopened this Apr 14, 2025
@github-actions github-actions bot added Size: S The size of the change in this PR is small and removed Size: XS The size of the change in this PR is very small labels Apr 14, 2025
Copy link
Contributor

@hartmannathan hartmannathan left a comment

Choose a reason for hiding this comment

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

Thanks for adding CMake support for this board!

@xiaoxiang781216 xiaoxiang781216 merged commit 732d811 into apache:master Apr 14, 2025
34 of 54 checks passed
@simbit18
Copy link
Contributor

simbit18 commented Apr 17, 2025

I was trying some tests with CMake

with this board there seems to be some problem.

D:\nuttx>cmake --build build
ninja: error: 'D:/nuttx/boards/arm/tiva/tm4c123g-launchpad/scripts/ld.script', needed by 'ld.script.tmp', missing and no known rule to make it

set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script")

https://github.com/apache/nuttx/tree/master/boards/arm/tiva/tm4c123g-launchpad/scripts

@roskuttan Please, could you check?

PR of fix #16238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Board: arm Size: S The size of the change in this PR is small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants