tools: kwboot: Do not use stack when setting baudrate back to default value
authorPali Rohár <pali@kernel.org>
Wed, 27 Oct 2021 18:57:02 +0000 (20:57 +0200)
committerStefan Roese <sr@denx.de>
Wed, 3 Nov 2021 05:45:27 +0000 (06:45 +0100)
commit8dbe027fc7d371d17a17a8bb5af8e99b5f20802b
treefe41bf34109aa79de6a35f5e49816962238f37d8
parent558176dcb14d589b5854bea0988301e27b60091d
tools: kwboot: Do not use stack when setting baudrate back to default value

The ARM code we inject into the image to change baudrate back to the
default value of 115200 Baud, which is run after successful UART transfer
of the whole image, cannot use stack as at this stage stack pointer is not
initialized yet.

Stack can only be used when BootROM is executing binary header, to
preserve state of registers, since BootROM expects that.

Change the ARM baudrate code to not use stack at all and put binary
header specific pre + post code (which stores and restores registers) into
separate arrays.

The baudrate change code now jumps at it's end and expects that there is
either code which returns to the BootROM or jumps to the original exec
address.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
tools/kwboot.c