Skip to content

Conversation

@ntavish
Copy link
Contributor

@ntavish ntavish commented Apr 17, 2025

The SoC has a Cortex-R5 CPU, it required big-endian and BE32 compiler flags. I enabled big-endian ARMv7-R in the SDK toolchain here, and maybe only this CPU uses it as of now: zephyrproject-rtos/sdk-ng#765

I only have (and plan to use) only this specific SoC (TMS570LC43xx), so I focus on getting this chip working, but variants should be able to utilize this code mostly as is (AFAIK).

There is some code in the soc directory (soc.c, asm_funcs.S, soc_pll_errata.c) that is adapted from "TI Halcogen" generated code. It was license BSD 3-clause, and I am checking with TI support if they could help re-licensing it, so I did not create an RFC for the board related to that yet. I did not want to add this to the HAL module, as I am exporting only very limited portions of what the Halcogen generates, but open to suggestions.

Comment on lines 177 to 183
config PLATFORM_SPECIFIC_PRE_STACK_INIT
bool "Platform (SOC) specific startup hook executed before the stack is initialised"
help
The platform specific initialization code (z_arm_platform_pre_stack_init) is
executed in the early startup code right after the registers are set to known
values and before stack is set up. Note that this code cannot use the stack unlike
z_arm_platform_init.
Copy link
Contributor

Choose a reason for hiding this comment

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

@nashif for review

Copy link
Contributor Author

Choose a reason for hiding this comment

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

decided to not include this commit, soc_reset_hook is sufficient with a small fix before jumping to z_prep_c.

Comment on lines 23 to 53
clocks {
/*
* OSC_IN (16 MHZ)
* -> PLL1 (300 MHz)
* -> GCLK1 (300 MHz)
* -> HCLK (150 MHz)
* -> VCLK (75 MHz)
* -> RTICLK (75 MHz, divider is bypassed when VCLK is the source)
*/
};
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this an empty section with no nodes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nordicjm thak you for the review, I have fixed the PR based on your comments. Sorry it was still in draft, I was rebasing and refactoring some code still from an older branch. I will still keep it in draft for today, while I add some description, and also try to figure out what to do with the BSD 3-clause code from TI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I squashed some commits and this comment block is left as is for reference, however, the section is no longer empty.

bool

config SOC_FAMILY
default "ti_hercules" if SOC_FAMILY_HERCULES
Copy link
Contributor

Choose a reason for hiding this comment

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

names must match either: default "hercules" if SOC_FAMILY_HERCULES or default "ti_hercules" if SOC_FAMILY_TI_HERCULES, soc.yml must also match

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 5 to 14
# TMS470 requires the ARM "legacy Word Invariant Addressing big-endian mode"
zephyr_compile_options(
-mbe32
${TOOLCHAIN_C_FLAGS}
)

zephyr_ld_options(
-mbe32
${TOOLCHAIN_LD_FLAGS}
)
Copy link
Contributor

Choose a reason for hiding this comment

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

@tejlmand for comment


# launchpad is 16MHz
config SYS_CLOCK_HW_CYCLES_PER_SEC
default 16000000
Copy link
Contributor

Choose a reason for hiding this comment

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

needs to come from dts property

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed the comment and value, but kept it in Kconfig.defconfig as several other SoCs seem to have it too.

Comment on lines 1 to 3
# SPDX-License-Identifier: Apache-2.0
CONFIG_PINCTRL=y
CONFIG_PINCTRL_TI_TMS570=y
Copy link
Contributor

Choose a reason for hiding this comment

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

no

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

default y
depends on DT_HAS_TI_TMS570_VIM_ENABLED
help
The TI Vectored Interrupt Manager provides hardware assistance for prioritizing
Copy link
Contributor

Choose a reason for hiding this comment

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

help indent is 1x tab followed by 2x spaces

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

if CPU_CORTEX_R5

config TMS570_VIM
Copy link
Contributor

Choose a reason for hiding this comment

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

how does this relate to cortex r5 if it's a ti specific thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 81 to 121

Copy link
Contributor

Choose a reason for hiding this comment

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

fix in original commit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, I think

Comment on lines 37 to 38
config FLASH_BASE_ADDRESS
default 1000000
default 0x00000000
Copy link
Contributor

Choose a reason for hiding this comment

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

fix in original commit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@ntavish ntavish force-pushed the feature/add-tms570lc43 branch from 6fb7d8e to 338a715 Compare April 24, 2025 04:45
@ntavish ntavish changed the title Feature/add tms570lc43 Add support for TI TMS570LC43 SoC Apr 24, 2025
@ntavish ntavish force-pushed the feature/add-tms570lc43 branch 6 times, most recently from c5325f3 to cc4599b Compare April 24, 2025 12:23
@ntavish ntavish marked this pull request as ready for review April 25, 2025 04:02
@github-actions github-actions bot added area: Testsuite Testsuite area: Pinctrl area: UART Universal Asynchronous Receiver-Transmitter area: GPIO platform: TI SimpleLink Texas Instruments SimpleLink MCU area: Interrupt Controller area: Timer Timer area: ARM ARM (32-bit) Architecture labels Apr 25, 2025
@ntavish ntavish force-pushed the feature/add-tms570lc43 branch 2 times, most recently from 9e56391 to 5aaadbf Compare June 17, 2025 06:26
@henrikbrixandersen henrikbrixandersen dismissed their stale review June 18, 2025 09:56

BSD licensed code moved to HAL in zephyrproject-rtos/hal_ti#63

@henrikbrixandersen henrikbrixandersen removed the Licensing The PR has licensing issues => licensing expert to review label Jun 18, 2025
@ntavish ntavish requested a review from nordicjm June 28, 2025 15:56
@ntavish ntavish force-pushed the feature/add-tms570lc43 branch from 5aaadbf to 5c9e447 Compare July 3, 2025 07:12
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 3, 2025

Comment on lines 9 to 11
config MULTITHREADING
default y

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
config MULTITHREADING
default y

@wearyzen wearyzen dismissed their stale review July 24, 2025 11:19

arm arch specific changes were removed so removing my -1

Comment on lines 27 to 40
+-----------+------------+--------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+======================================+
| VIM | on-chip | Vectored interrupt manager |
+-----------+------------+--------------------------------------+
| SCI | on-chip | Serial communication interface |
+-----------+------------+--------------------------------------+
| IOMM | on-chip | Pin multiplexing |
+---------------------------------------------------------------+
| GIO | on-chip | General purpose input / output |
+-----------+------------+--------------------------------------+
| RTI | on-chip | Real-time interrupt |
+-----------+------------+--------------------------------------+
Copy link
Contributor

Choose a reason for hiding this comment

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

just let the .. zephyr:board-supported-hw:: work its magic

Suggested change
+-----------+------------+--------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+======================================+
| VIM | on-chip | Vectored interrupt manager |
+-----------+------------+--------------------------------------+
| SCI | on-chip | Serial communication interface |
+-----------+------------+--------------------------------------+
| IOMM | on-chip | Pin multiplexing |
+---------------------------------------------------------------+
| GIO | on-chip | General purpose input / output |
+-----------+------------+--------------------------------------+
| RTI | on-chip | Real-time interrupt |
+-----------+------------+--------------------------------------+

@@ -0,0 +1,5 @@
board:
name: tms570_launchxl2
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
name: tms570_launchxl2
name: tms570_launchxl2
full_name: Hercules TMS570LC43x LaunchPad

Copy link
Contributor

Choose a reason for hiding this comment

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

ping

@ntavish ntavish force-pushed the feature/add-tms570lc43 branch from 5c9e447 to 5d2a1df Compare August 18, 2025 04:23
@ntavish ntavish requested review from kartben and nordicjm August 18, 2025 10:28
nordicjm
nordicjm previously approved these changes Sep 1, 2025
Tavish Naruka added 8 commits September 1, 2025 23:29
Adds new SoC. Some of the necessary startup code is based on the
vendor provides tool (halcogen) and it includes SoC init and
some errata handling. That code originally had BSD-3-clause license,
so it cannot be part of this commit, and has been moved to TI hal
repository (modules/hal/ti).

The Halcogen code was mostly adapted to zephyr coding style and
the the dependencies were minimized.

As for erratas, the included one right now is PLL startup problem
errata.

We also have CORTEX-R5#7 (ARM ID-780125), but it was not included
because:

1. Halcogen code does not implement it
3. This is Cortex R5 errata, Xilinx R5 implementation has this note
https://adaptivesupport.amd.com/s/article/65878

Signed-off-by: Tavish Naruka <[email protected]>
Adds driver for TI TMS570 SoC.

Signed-off-by: Tavish Naruka <[email protected]>
Adds SCI peripheral UART driver for TMS570.

Signed-off-by: Tavish Naruka <[email protected]>
Add TI VIM driver specific to the TMS570 chips. This driver/peripheral
is not compatible with the existing intc_vim.c for some other TI chips.

Signed-off-by: Tavish Naruka <[email protected]>
Adds the RTI timer for TI TMS570 SoC and enables it as the system timer
for enabling multithreading.

Signed-off-by: Tavish Naruka <[email protected]>
Adds TI TMS570 SoC GPIO driver.

Signed-off-by: Tavish Naruka <[email protected]>
Adds minimal config for TI TMS570 launchpad which has the
TMS570LC43 SoC.

Signed-off-by: Tavish Naruka <[email protected]>
Adds basic information about the board about supported peripherals.

Signed-off-by: Tavish Naruka <[email protected]>
@ntavish
Copy link
Contributor Author

ntavish commented Sep 1, 2025

Sorry, one (hopefully final) code push here to move back one of the header files (Apache 2.0 licensed) back to zephyr soc directory from the hal_ti module which did not really need those. Now both soc_defaults.h soc_internal.h are included in soc directory (same as before I moved some code to hal_ti)

Copy link
Contributor

@kartben kartben left a comment

Choose a reason for hiding this comment

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

+1 for docs, thanks

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 1, 2025

SW_RESET = 0x0010U, /**< Alias for Software Reset */
EXT_RESET = 0x0008U, /**< Alias for External Reset */
NO_RESET = 0x0000U /**< Alias for No Reset */
} resetSource_t;
Copy link
Contributor

Choose a reason for hiding this comment

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

needs to be snake case not camel case

Comment on lines +177 to +178
void _mpuInit_(void);
uint32_t _errata_SSWF021_45_both_plls(uint32_t count);
Copy link
Contributor

Choose a reason for hiding this comment

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

and these?

@github-actions
Copy link

github-actions bot commented Nov 2, 2025

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ARM ARM (32-bit) Architecture area: GPIO area: Interrupt Controller area: Pinctrl area: Testsuite Testsuite area: Timer Timer area: UART Universal Asynchronous Receiver-Transmitter platform: TI SimpleLink Texas Instruments SimpleLink MCU Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants