Skip to content

Commit

Permalink
#12979: erisc linker script cleanup (part 2/n) (#14164)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-TT authored Oct 23, 2024
1 parent f3bb40c commit e62b57a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 25 deletions.
2 changes: 1 addition & 1 deletion tt_metal/hw/inc/debug/dprint.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
#define DPRINT_DATA1(x)
#endif
namespace internal_ {
void __attribute__((section("code_l1"))) risc_context_switch();
void risc_context_switch();
}

struct BF16 { uint16_t val; BF16(uint16_t val) : val(val) {} } ATTR_PACK;
Expand Down
2 changes: 1 addition & 1 deletion tt_metal/hw/inc/debug/watcher_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#if defined(COMPILE_FOR_ERISC)
// Forward declare these functions to avoid including erisc.h -> circular dependency via noc_nonblocking_api.h, sanitize_noc.h.
namespace internal_ {
void __attribute__((section("code_l1"))) risc_context_switch();
void risc_context_switch();
void disable_erisc_app();
}

Expand Down
2 changes: 1 addition & 1 deletion tt_metal/hw/inc/ethernet/erisc.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ volatile uint32_t *flag_disable = (uint32_t *)(eth_l1_mem::address_map::LAUNCH_E

namespace internal_ {
inline __attribute__((always_inline))
void __attribute__((section("code_l1"))) risc_context_switch() {
void risc_context_switch() {
ncrisc_noc_full_sync();
rtos_context_switch_ptr();
ncrisc_noc_counters_init();
Expand Down
6 changes: 1 addition & 5 deletions tt_metal/hw/inc/risc_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,7 @@ inline uint32_t special_mult(uint32_t a, uint32_t special_b) {
#if !defined(COMPILE_FOR_TRISC) // BRISC, NCRISC, ERISC, IERISC
#include "noc_nonblocking_api.h"

#if defined(COMPILE_FOR_ERISC)
// ERISC needs to place this function in a specific section
__attribute__((section("code_l1")))
#endif // defined(COMPILE_FOR_ERISC)
void risc_init() {
inline void risc_init() {
for (uint32_t n = 0; n < NUM_NOCS; n++) {
uint32_t noc_id_reg = NOC_CMD_BUF_READ_REG(n, 0, NOC_NODE_ID);
my_x[n] = noc_id_reg & NOC_NODE_ID_MASK;
Expand Down
26 changes: 9 additions & 17 deletions tt_metal/hw/toolchain/erisc-b0-app-sections.ld
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,23 @@ SECTIONS
PROVIDE (__global_pointer$ = __firmware_global_pointer);
PROVIDE (__erisc_jump_table = ORIGIN(ERISC_JUMPTABLE));

.start :
{
*(.start)
} > REGION_APP_CODE
code_l1 :
{
*(code_l1)
} > REGION_APP_CODE
.init :
{
KEEP (*(SORT_NONE(.init)))
} > REGION_APP_CODE
PROVIDE (__ecode_l1 = .);
/* TODO: add back when using iram code loading
.text :

{
*(.start)
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
*(.text.exit .text.exit.*)
*(.text.startup .text.startup.*)
*(.text.hot .text.hot.*)
*(.text .stub .text.* .gnu.linkonce.t.*)
/* .gnu.warning sections are handled specially by elf32.em.
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
} > REGION_APP_IRAM_CODE AT > ERISC_OVERLAY*/
} > REGION_APP_CODE
.init.fini :
{
/* We don't use .init/.fini (this isn't the '90s), make sure there aren't any. */
KEEP (*(.init .fini))
ASSERT(SIZEOF(.init.fini) == 0, ".init/.fini sections present");
} > REGION_APP_CODE

.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } > REGION_APP_CODE
.rodata1 : { *(.rodata1) } > REGION_APP_CODE
Expand Down

0 comments on commit e62b57a

Please sign in to comment.