Skip to content

Commit 312f9db

Browse files
unicornxRbb666
authored andcommitted
libcpu: riscv: declare external symbols inside
libcpu/risc-v/common64/mmu.c uses the external symbol "__bss_end" (this symbol generally is defined in the link script file) and depends on the extern declaration of this symbol in the bsp's "board.h". This is not a problem in implementation, but it is not a good habit. If this extern symbol is used locally, just declare it locally should be better. In this way, there will be no dependency of the kernel core on the bsp header file. And there will be no special requirements for the bsp board code, such as the need to make extern declarations for these "__bss_end" symbols in "board.h". This patch currently only explicitly externly declares "__bss_end" inside libcpu itself. The code of "#include <board.h>" is kept, because the modification involved is too large, it is necessary to clean up the bsp involved before cleaning this include code line uniformly. Signed-off-by: Chen Wang <[email protected]>
1 parent 5c9f618 commit 312f9db

File tree

1 file changed

+2
-0
lines changed
  • libcpu/risc-v/common64

1 file changed

+2
-0
lines changed

libcpu/risc-v/common64/mmu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,8 @@ void rt_hw_mmu_setup(rt_aspace_t aspace, struct mem_desc *mdesc, int desc_nr)
648648

649649
#define SATP_BASE ((rt_ubase_t)SATP_MODE << SATP_MODE_OFFSET)
650650

651+
extern unsigned int __bss_end;
652+
651653
/**
652654
* @brief Early memory setup function for hardware initialization.
653655
*

0 commit comments

Comments
 (0)