[U-Boot] [PATCH] arm: socfpga: Fix bootcounter located at the end of internal SRAM

Marek Vasut marex at denx.de
Tue Oct 30 10:24:11 UTC 2018


On 10/30/2018 10:36 AM, Stefan Roese wrote:
> Hi Simon,
> 
> On 30.10.18 10:07, Simon Goldschmidt wrote:
>>
>>
>> Stefan Roese <sr at denx.de <mailto:sr at denx.de>> schrieb am Di., 30. Okt.
>> 2018, 10:00:
>>
>>     Commit 768f23dc8ae3 ("ARM: socfpga: Put stack at the end of SRAM")
>> broke
>>     those socfpga boards that keep the bootcounter at the end of the
>>     internal SRAM as the bootcounter needs 8 bytes by default and thus
>> the
>>     very first SPL call to board_init_f_alloc_reserve overwrites the
>>     bootcounter.
>>
>>     This patch allows to move the initial stack pointer down a bit by
>>     checking if CONFIG_SYS_BOOTCOUNT_ADDR is located in the internal SRAM
>>     area and then using this address as location for the start of the
>>     stack pointer.
>>
>>     No new macros / defines are added by this approach.
>>
>>
>> Ok, so no new macros are defined, but this is limited to the boot
>> counter. However, I need to store additional data that survives a
>> reboot somewhere, so I think an explicit range reservation would
>> be nicer.
> 
> Ah, I was not aware that you have a different reasoning to allocate
> some memory in the internal SRAM.
>  
>> I could still do what I want with your patch by allocating my data
>> above the bootcounter, but this works in a more or less implicit/
>> hidden way, not explicitly configured...
> 
> Some implicit (hidden) means is definitely not good. You can go ahead
> with your approach. But please don't introduce new defines for things
> that are already configured - meaning 0x8 bytes reserved and 0xfffffff8
> as bootcounter location are redundant. This is a bit messy and might
> get out of hand, once those defines are not in sync any more.
> 
> And you probably need to add new defines to Kconfig as well
> (e.g. SOCFPGA_INIT_RAM_END_RESERVE).

Thanks for discussing this and finding a better solution. I'm looking
forward to the new patch.

-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list