diff mbox series

[4/4] configs: visionfive2: enable SPL_YMODEM_SUPPORT

Message ID 20240415115035.46199-5-heinrich.schuchardt@canonical.com
State New
Delegated to: Andes
Headers show
Series board: starfive: add Milk-V Mars CM support | expand

Commit Message

Heinrich Schuchardt April 15, 2024, 11:50 a.m. UTC
We can use U-Boot for recovering JH7110 based boards via UART
if CONFIG_SPL_YMODEM_SUPPORT=y.

* Send u-boot-spl.normal.out via XMODEM.
* Send u-boot.itb via YMODEM.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 configs/starfive_visionfive2_defconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

E Shattow April 17, 2024, 1:41 a.m. UTC | #1
Successful in use w/ 'tio' serial tool and Adafruit CP2102N Friend
adapter on Mars CM Lite board in DFRobot mini router carrier.

While SPL and u-boot.itb payload are sourced via UART the environment
variables are from the environment variable storage as-is. This makes
sense in the use case for development but may have side-effects in the
case of U-Boot as a JH7110 recovery tool. There is now 'env default -f
-a' which does not purge non-default variables and retains the
non-default variables when migrating from vendor firmware. Consider to
also build for U-Boot the commands that can aid in cleaning the stored
environment variable state CONFIG_CMD_ERASEENV=y and in-memory state
CONFIG_CMD_NVEDIT_LOAD=y. With these it can be done easily with: 'env
erase; env load; env save'.

On Mon, Apr 15, 2024 at 4:51 AM Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> We can use U-Boot for recovering JH7110 based boards via UART
> if CONFIG_SPL_YMODEM_SUPPORT=y.
>
> * Send u-boot-spl.normal.out via XMODEM.
> * Send u-boot.itb via YMODEM.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  configs/starfive_visionfive2_defconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig
> index fa80d489f5e..e2d83c62b28 100644
> --- a/configs/starfive_visionfive2_defconfig
> +++ b/configs/starfive_visionfive2_defconfig
> @@ -62,6 +62,7 @@ CONFIG_SPL_I2C=y
>  CONFIG_SPL_DM_SPI_FLASH=y
>  CONFIG_SPL_DM_RESET=y
>  CONFIG_SPL_SPI_LOAD=y
> +CONFIG_SPL_YMODEM_SUPPORT=y
>  CONFIG_SYS_PROMPT="StarFive # "
>  CONFIG_CMD_EEPROM=y
>  CONFIG_SYS_EEPROM_SIZE=512
> --
> 2.43.0
>

Tested-by: E Shattow <lucent@gmail.com>
Heinrich Schuchardt April 17, 2024, 8:22 a.m. UTC | #2
On 17.04.24 03:41, E Shattow wrote:
> Successful in use w/ 'tio' serial tool and Adafruit CP2102N Friend
> adapter on Mars CM Lite board in DFRobot mini router carrier.
> 
> While SPL and u-boot.itb payload are sourced via UART the environment
> variables are from the environment variable storage as-is. This makes
> sense in the use case for development but may have side-effects in the
> case of U-Boot as a JH7110 recovery tool. There is now 'env default -f
> -a' which does not purge non-default variables and retains the
> non-default variables when migrating from vendor firmware. Consider to
> also build for U-Boot the commands that can aid in cleaning the stored
> environment variable state CONFIG_CMD_ERASEENV=y and in-memory state
> CONFIG_CMD_NVEDIT_LOAD=y. With these it can be done easily with: 'env
> erase; env load; env save'.

Thank you for testing.

After erasing there is no need to save the environment. If there is no 
environment on flash, the default will be loaded anyway:

   *** Warning - bad CRC, using default environment

Instead of 'env erase' you could use 'sf erase 0xf0000 0x1000' which is 
already available. As adding CONFIG_CMD_ERASEENV=y is not necessary in 
the scope of this patch series I would prefer leaving it to future 
discussion.

Best regards

Heinrich

> 
> On Mon, Apr 15, 2024 at 4:51 AM Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
>>
>> We can use U-Boot for recovering JH7110 based boards via UART
>> if CONFIG_SPL_YMODEM_SUPPORT=y.
>>
>> * Send u-boot-spl.normal.out via XMODEM.
>> * Send u-boot.itb via YMODEM.
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
>> ---
>>   configs/starfive_visionfive2_defconfig | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig
>> index fa80d489f5e..e2d83c62b28 100644
>> --- a/configs/starfive_visionfive2_defconfig
>> +++ b/configs/starfive_visionfive2_defconfig
>> @@ -62,6 +62,7 @@ CONFIG_SPL_I2C=y
>>   CONFIG_SPL_DM_SPI_FLASH=y
>>   CONFIG_SPL_DM_RESET=y
>>   CONFIG_SPL_SPI_LOAD=y
>> +CONFIG_SPL_YMODEM_SUPPORT=y
>>   CONFIG_SYS_PROMPT="StarFive # "
>>   CONFIG_CMD_EEPROM=y
>>   CONFIG_SYS_EEPROM_SIZE=512
>> --
>> 2.43.0
>>
> 
> Tested-by: E Shattow <lucent@gmail.com>
E Shattow April 17, 2024, 7:28 p.m. UTC | #3
On Wed, Apr 17, 2024 at 1:22 AM Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> On 17.04.24 03:41, E Shattow wrote:
> > Successful in use w/ 'tio' serial tool and Adafruit CP2102N Friend
> > adapter on Mars CM Lite board in DFRobot mini router carrier.
> >
> > While SPL and u-boot.itb payload are sourced via UART the environment
> > variables are from the environment variable storage as-is. This makes
> > sense in the use case for development but may have side-effects in the
> > case of U-Boot as a JH7110 recovery tool. There is now 'env default -f
> > -a' which does not purge non-default variables and retains the
> > non-default variables when migrating from vendor firmware. Consider to
> > also build for U-Boot the commands that can aid in cleaning the stored
> > environment variable state CONFIG_CMD_ERASEENV=y and in-memory state
> > CONFIG_CMD_NVEDIT_LOAD=y. With these it can be done easily with: 'env
> > erase; env load; env save'.
>
> Thank you for testing.
>
> After erasing there is no need to save the environment. If there is no
> environment on flash, the default will be loaded anyway:
>
>    *** Warning - bad CRC, using default environment
>
> Instead of 'env erase' you could use 'sf erase 0xf0000 0x1000' which is
> already available. As adding CONFIG_CMD_ERASEENV=y is not necessary in
> the scope of this patch series I would prefer leaving it to future
> discussion.
>
> Best regards
>
> Heinrich
>

The 'env erase; env load; env save' can be done at the same session
just before recovery write to provide a sanitized environment with the
defaults of the present U-Boot payload loaded via UART, so is not the
same as 'sf erase ...' waiting for a reboot (5 minutes more to
transfer via UART at 115200 baud) and needing to interrupt the boot to
further 'env save'. Having 'env load' allows to allow that reboot step
in-between. Point taken though, it's helpful for recovery but not
required. -E
E Shattow April 17, 2024, 7:29 p.m. UTC | #4
P.S. mis-spoke should have written "Having 'env load' allows to skip
that reboot step
in-between

On Wed, Apr 17, 2024 at 12:28 PM E Shattow <lucent@gmail.com> wrote:
>
> On Wed, Apr 17, 2024 at 1:22 AM Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
> >
> > On 17.04.24 03:41, E Shattow wrote:
> > > Successful in use w/ 'tio' serial tool and Adafruit CP2102N Friend
> > > adapter on Mars CM Lite board in DFRobot mini router carrier.
> > >
> > > While SPL and u-boot.itb payload are sourced via UART the environment
> > > variables are from the environment variable storage as-is. This makes
> > > sense in the use case for development but may have side-effects in the
> > > case of U-Boot as a JH7110 recovery tool. There is now 'env default -f
> > > -a' which does not purge non-default variables and retains the
> > > non-default variables when migrating from vendor firmware. Consider to
> > > also build for U-Boot the commands that can aid in cleaning the stored
> > > environment variable state CONFIG_CMD_ERASEENV=y and in-memory state
> > > CONFIG_CMD_NVEDIT_LOAD=y. With these it can be done easily with: 'env
> > > erase; env load; env save'.
> >
> > Thank you for testing.
> >
> > After erasing there is no need to save the environment. If there is no
> > environment on flash, the default will be loaded anyway:
> >
> >    *** Warning - bad CRC, using default environment
> >
> > Instead of 'env erase' you could use 'sf erase 0xf0000 0x1000' which is
> > already available. As adding CONFIG_CMD_ERASEENV=y is not necessary in
> > the scope of this patch series I would prefer leaving it to future
> > discussion.
> >
> > Best regards
> >
> > Heinrich
> >
>
> The 'env erase; env load; env save' can be done at the same session
> just before recovery write to provide a sanitized environment with the
> defaults of the present U-Boot payload loaded via UART, so is not the
> same as 'sf erase ...' waiting for a reboot (5 minutes more to
> transfer via UART at 115200 baud) and needing to interrupt the boot to
> further 'env save'. Having 'env load' allows to allow that reboot step
> in-between. Point taken though, it's helpful for recovery but not
> required. -E
diff mbox series

Patch

diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig
index fa80d489f5e..e2d83c62b28 100644
--- a/configs/starfive_visionfive2_defconfig
+++ b/configs/starfive_visionfive2_defconfig
@@ -62,6 +62,7 @@  CONFIG_SPL_I2C=y
 CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_DM_RESET=y
 CONFIG_SPL_SPI_LOAD=y
+CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_SYS_PROMPT="StarFive # "
 CONFIG_CMD_EEPROM=y
 CONFIG_SYS_EEPROM_SIZE=512