Skip to content

Conversation

@nandojve
Copy link
Member

@nandojve nandojve commented Aug 4, 2021

The current riscv linker script don't have sections for Data & Instruction Tightly Coupled Memory. Add itcm and dtcm sections to make it available.

Signed-off-by: Gerson Fernando Budke [email protected]

@nandojve nandojve added this to the v2.7.0 milestone Aug 4, 2021
@github-actions github-actions bot added area: API Changes to public APIs area: RISCV RISCV Architecture (32-bit & 64-bit) labels Aug 4, 2021
@katsuster
Copy link
Member

@nandojve
Hello. I agreed with your changing policy. We will be happy to use DTCM and ITCM for more faster speed.

My opinion is DTCM and ITCM are implemented on SiFive SoCs, but are they based on some standard of RISC-V arch?
If not, these change should NOT be implemented into common RISC-V arch files (arch/riscv/common). It's better into SoC specific linker script.

@nandojve
Copy link
Member Author

nandojve commented Aug 8, 2021

@nandojve
Hello. I agreed with your changing policy. We will be happy to use DTCM and ITCM for more faster speed.

My opinion is DTCM and ITCM are implemented on SiFive SoCs, but are they based on some standard of RISC-V arch?
If not, these change should NOT be implemented into common RISC-V arch files (arch/riscv/common). It's better into SoC specific linker script.

Hi @katsuster ,

This is for a SiFive E24 core with two TCM units of 48k each. Both units can be used for instruction or data and can be combined on a big 96k region, since are continuous.

@cfriedt
Copy link
Member

cfriedt commented Aug 11, 2021

@nandojve, @katsuster -

The concept of TCM is not specific to any architecture.

Just with a quick grep, it looks as though the concepts of itcm / dtcm are not architecture-specific in Zephyr (which is a good thing, and I'm happy to see that). The terminology originates from ARM of course. SiFive actually calls their implementation TIM (tightly-integrated memory).

Sources:

  • include/linker/linker-defs.h
  • include/linker/sections.h
  • include/linker/section_tags.h

Likely the addition did come from ARM / cortex-m though

  • include/arch/arm/aarch32/cortex_m/scripts/linker.ld

Given that, I don't see a problem with adding it here as well, or to any other architecture for that matter. I think it was likely defined in an architecture-independent way specifically for this use case.

Copy link
Member

@cfriedt cfriedt left a comment

Choose a reason for hiding this comment

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

Please increase alignment to 8 bytes to accomodate rv64. Alignment could also eventually be a DT property.

@nandojve nandojve force-pushed the riscv_add_linker_dtm_sections branch from bf1a57c to bd510ac Compare August 11, 2021 19:10
@nandojve
Copy link
Member Author

Just with a quick grep, it looks as though the concepts of itcm / dtcm are not architecture-specific in Zephyr (which is a good thing, and I'm happy to see that). The terminology originates from ARM of course. SiFive actually calls their implementation TIM (tightly-integrated memory).

Yes, names were chosen to be compliant with zephyr,i/dtcm devicetree nodes, for instance:

zephyr,itcm = &itcm;
zephyr,dtcm = &dtcm;

Please increase alignment to 8 bytes to accomodate rv64.

All sections were align to 8 bytes, just to make sure.

@nandojve nandojve requested a review from cfriedt August 11, 2021 19:17
The current riscv linker script don't have sections for
Data & Instruction Tightly Coupled Memory.  Add itcm and
dtcm sections to make it available.  All sections were
8 byte align to keep compatible with rv64 SoCs.

Signed-off-by: Gerson Fernando Budke <[email protected]>
@nandojve nandojve force-pushed the riscv_add_linker_dtm_sections branch from bd510ac to e99513e Compare August 11, 2021 22:18
@nandojve
Copy link
Member Author

nandojve commented Aug 11, 2021

Apply #37484 rename.

@cfriedt cfriedt merged commit a54fa4e into zephyrproject-rtos:main Aug 15, 2021
@nandojve nandojve deleted the riscv_add_linker_dtm_sections branch August 15, 2021 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: API Changes to public APIs area: Linker Scripts area: RISCV RISCV Architecture (32-bit & 64-bit)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants