[U-Boot] [PATCH v5] arm: socfpga: fix U-Boot running from fpga OnChip RAM

Simon Goldschmidt simon.k.r.goldschmidt at gmail.com
Thu Aug 16 13:12:36 UTC 2018


Marek Vasut <marex at denx.de> schrieb am Do., 16. Aug. 2018, 15:06:

> On 08/16/2018 03:00 PM, Simon Goldschmidt wrote:
> > On Thu, Aug 16, 2018 at 1:18 PM Marek Vasut <marex at denx.de> wrote:
> >>
> >> On 08/16/2018 09:38 AM, Simon Goldschmidt wrote:
> >>> gd->env_addr points to pre-relocation address even after
> >>> relocation. This leads to an abort in env_callback_init
> >>> when loading the environment.
> >>>
> >>> Fix this by enabling CONFIG_SYS_EXTRA_ENV_RELOC.
> >>>
> >>> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt at gmail.com>
> >>
> >> I have one last question -- does this somehow influence SPL ?
> >
> > No, it doesn't. The code that gets enabled by this define is in
> > common/board_r.c, which is not linked for SPL.
>
> Ah, thanks for checking.
>
> btw do you think it'd make sense to just enable this by default on all
> systems and zap the EXTRA_ENV_RELOC macro altogether ?
>

Yes, that's what I have thought about already. Just like the for the
embedded device tree relocation, we could then probably use gd->reloc_off
instead of CONFIG_SYS_MONITOR_BASE. I'm just not sure this really works for
all boards, but it would be worth a try to push after this release is out.

Simon


> >>
> >>> ---
> >>>
> >>> Changes in v5:
> >>> Improve comments
> >>>
> >>> Changes in v4:
> >>> enable this fix for all socfpga, not for gen5 only
> >>>
> >>> Changes in v3:
> >>> this patch is new in v3
> >>>
> >>> Changes in v2:
> >>> None
> >>>
> >>>  include/configs/socfpga_common.h | 12 ++++++++++++
> >>>  1 file changed, 12 insertions(+)
> >>>
> >>> diff --git a/include/configs/socfpga_common.h
> b/include/configs/socfpga_common.h
> >>> index 8ebf6b85fe..8b9f0427c0 100644
> >>> --- a/include/configs/socfpga_common.h
> >>> +++ b/include/configs/socfpga_common.h
> >>> @@ -284,6 +284,18 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
> >>>  #define CONFIG_SPL_STACK             CONFIG_SYS_SPL_MALLOC_START
> >>>  #endif
> >>>
> >>> +/*
> >>> + * When U-Boot is started from FPGA, prevent gd->env_addr to point
> into
> >>> + * FPGA OnChip RAM after relocation
> >>> + */
> >>> +#define CONFIG_SYS_EXTRA_ENV_RELOC
> >>> +/*
> >>> + * CONFIG_SYS_EXTRA_ENV_RELOC code needs this to calculate the
> relocation
> >>> + * offset for gd->env_addr. Since this is based on gd->relocaddr, we
> need
> >>> + * to use CONFIG_SYS_TEXT_BASE here.
> >>> + */
> >>> +#define CONFIG_SYS_MONITOR_BASE      CONFIG_SYS_TEXT_BASE
> >>> +
> >>>  /* Extra Environment */
> >>>  #ifndef CONFIG_SPL_BUILD
> >>>
> >>>
> >>
> >>
> >> --
> >> Best regards,
> >> Marek Vasut
>
>
> --
> Best regards,
> Marek Vasut
>


More information about the U-Boot mailing list