Hi Padmarao, I am working on a RISC-V bsp variant for the Kendryte K210 and I am also using an included DTB. For my k210 bsp, I changed riscv/shared/start/start.S to set the address of the DTB array before calling bsp_fdt_copy. If we change start.S to handle the following three cases, we would not have to change the bsp_fdt_copy function. The three cases are: - no FDT, I assume griscv bsp - uboot - a0 in contains the address of the u-boot loaded DTB - polarfire, k210 and others - set a0 to the address of the included DTB array I think it's better to keep this function generic and not have to conditionally ignore the input parameter.
Thanks, Alan On Thu, Sep 8, 2022 at 11:44 AM Padmarao Begari < padmarao.beg...@microchip.com> wrote: > If the bsp is integrated and supported a device tree > blob(dtb) then use dtb instead of using it from the U-Boot. > --- > bsps/shared/start/bsp-fdt.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/bsps/shared/start/bsp-fdt.c b/bsps/shared/start/bsp-fdt.c > index 75a1ea41c9..7e1a698896 100644 > --- a/bsps/shared/start/bsp-fdt.c > +++ b/bsps/shared/start/bsp-fdt.c > @@ -32,6 +32,10 @@ > #include <bsp/fdt.h> > #include <bsp/linker-symbols.h> > > +#ifdef BSP_DTB_IS_SUPPORTED > +#include BSP_DTB_HEADER_PATH > +#endif > + > #ifndef BSP_FDT_IS_SUPPORTED > #warning "BSP FDT support indication not defined" > #endif > @@ -51,7 +55,12 @@ bsp_fdt_blob[BSP_FDT_BLOB_SIZE_MAX / sizeof(uint32_t)]; > > void bsp_fdt_copy(const void *src) > { > +#ifdef BSP_DTB_IS_SUPPORTED > +const volatile uint32_t *s = (const uint32_t *) system_dtb; > +#else > const volatile uint32_t *s = (const uint32_t *) src; > +#endif > + > #ifdef BSP_FDT_BLOB_COPY_TO_READ_ONLY_LOAD_AREA > uint32_t *d = (uint32_t *) ((uintptr_t) &bsp_fdt_blob[0] > - (uintptr_t) bsp_section_rodata_begin > @@ -61,7 +70,7 @@ void bsp_fdt_copy(const void *src) > #endif > > if (s != d) { > - size_t m = MIN(sizeof(bsp_fdt_blob), fdt_totalsize(src)); > + size_t m = MIN(sizeof(bsp_fdt_blob), fdt_totalsize(s)); > size_t aligned_size = roundup2(m, CPU_CACHE_LINE_BYTES); > size_t n = (m + sizeof(*d) - 1) / sizeof(*d); > size_t i; > -- > 2.25.1 > > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel >
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel