fix the boot issue of Rockchip RK3036
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
cover fix the boot issue of Rockchip RK3036
Hi Philipp:
Quoted 22 lines · Dr. Philipp Tomsich
Andy,
Quoted 20 lines · Andy Yan
As Kever mentioned in [0], the RK3036 based boards could't bootup for a long time.
After a git bisect, I found the RK3036 SPL code size has increased from patch [1] [2]. Before Tom's patch [1], the SPL size is 3160 bytes, but it becomes 4080 bytes after [1] applied. After a look at this patch, I realised I should disable SPL_USE_ARCH_MEMCPY/MEMSET, and the code size indeed come down after I disabled them. But I got a LD error after apply patch[2]: "undefined reference to memset", RK3036 SPL didn't use lib/string because of the sram space imitation. The compile succeed afterCONFIG_SPL_LIBGENERIC_SUPPORTenabled, but the spl code size become 3248 bytes.Additionally, Simon post patch [3] call printf to print a message before back to bootrom from spl, which make the spl code size increased to nearly 3.7 kb.
Quoted 8 lines
Quoted 3 lines
RK3036 SPL only has 4kb sram to use, the spl code will use 3.4 ~ 3.5 kb, the last 0.5kb are used for SP and GD, so there is no space for malloc.
gcc-6-arm-linux-gnueabi
What version of GCC are you using?
If your problem can also be solved by moving to GCC 6.3 (or newer) and the code-size improvements there, I’d rather just require a more recent GCC version.
I default use arm-linux-gnueabe-gcc v5.4.
The current upstream kylin-rk3036_defconfig compiled by gcc-5.4 is
4384 bytes, the size comes down to 3936 bytes if I use arm-linux-gnueabihf-gcc v6.3 from linaro. But this is still too large for rk3036.
Disable SPL_USE_ARCH_MEMCPY/MEMSET will make the spl size comes
down to 3042 bytes by gcc v6.3. But I still need some hack: enable CONFIG_SPL_LIBGENERIC to get support for memset, masks Simon's print in bootrom.c, or the code size will become very large. Event though this hack make things work, we still lost a few hundreds bytes by function board_init_f_alloc_reserve, because platforms with very limit sram like rk3036 will return to bootrom after the dram initialized, they never use the malloc space. This few hundreds bytes is a large space for 4kb sarm, it's better to letf them for code or SP.
Quoted 2 lines
Another thing to check would be whether you are building SPL as a THUMB2 binary, as this can also help with the SPL size.
Yes, THUMB2 is default enabled.
Quoted 34 lines
Quoted 31 lines
To fix this issue on RK3036, I disabled
CONFIG_SPL_LIBGENERIC_SUPPORT, also makeboard_init_f_alloc_reserveandboard_init_f_init_reserveas weak function, then override them inrk3036-board-spl.cwith a no malloc resered function.[0] https://lists.denx.de/pipermail/u-boot/2017-May/292744.html
[1] http://patchwork.ozlabs.org/patch/714593/
[2] http://patchwork.ozlabs.org/patch/714592/
[3] http://patchwork.ozlabs.org/patch/751080/Andy Yan (5):
board_init.c: make the reserve functions as weak
rockchip: rk3036: only reserve space for GD and SP in SPL stage
rockchip: configs: disable SPL_ARCH_MEMCPY/MEMSET for rk3036
rockchip: configs: add DEBUG UART for kylin board
rockchip: add u-boot specific dts for rk3036 sdkarch/arm/dts/rk3036-sdk-u-boot.dtsi | 11 +++++++++ arch/arm/mach-rockchip/rk3036-board-spl.c | 37 +++++++++++++++++++++++++++++++ common/init/board_init.c | 4 ++-- configs/evb-rk3036_defconfig | 2 ++ configs/kylin-rk3036_defconfig | 6 +++++ 5 files changed, 58 insertions(+), 2 deletions(-)create mode 100644
arch/arm/dts/rk3036-sdk-u-boot.dtsiSignature · 1 line
2.7.4
cover fix the boot issue of Rockchip RK3036
Quoted 35 lines · Andy Yan
Hi Philipp:
Quoted 22 lines · Dr. Philipp Tomsich
Andy,
Quoted 20 lines · Andy Yan
As Kever mentioned in [0], the RK3036 based boards could't bootup for a long time.
After a git bisect, I found the RK3036 SPL code size has increased from patch [1] [2]. Before Tom's patch [1], the SPL size is 3160 bytes, but it becomes 4080 bytes after [1] applied. After a look at this patch, I realised I should disable SPL_USE_ARCH_MEMCPY/MEMSET, and the code size indeed come down after I disabled them. But I got a LD error after apply patch[2]: "undefined reference to memset", RK3036 SPL didn't use lib/string because of the sram space imitation. The compile succeed afterCONFIG_SPL_LIBGENERIC_SUPPORTenabled, but the spl code size become 3248 bytes.Additionally, Simon post patch [3] call printf to print a message before back to bootrom from spl, which make the spl code size increased to nearly 3.7 kb.
Quoted 8 lines
Quoted 3 lines
RK3036 SPL only has 4kb sram to use, the spl code will use 3.4 ~ 3.5 kb, the last 0.5kb are used for SP and GD, so there is no space for malloc.
gcc-6-arm-linux-gnueabi
What version of GCC are you using?
If your problem can also be solved by moving to GCC 6.3 (or newer) and the code-size improvements there, I’d rather just require a more recent GCC version.
Quoted 5 lines
I default use arm-linux-gnueabe-gcc v5.4.
The current upstream kylin-rk3036_defconfig compiled by gcc-5.4
is 4384 bytes, the size comes down to 3936 bytes if I use arm-linux-gnueabihf-gcc v6.3 from linaro. But this is still too large for rk3036.
Please note that (and U-Boot should be complaining at you) that with v2018.01 we'll be moving to gcc-6.x or later for ARM.
Quoted 10 lines
Disable SPL_USE_ARCH_MEMCPY/MEMSET will make the spl size comes
down to 3042 bytes by gcc v6.3. But I still need some hack: enableCONFIG_SPL_LIBGENERICto get support for memset, masks Simon's print inbootrom.c, or the code size will become very large. Event though this hack make things work, we still lost a few hundreds bytes by functionboard_init_f_alloc_reserve, because platforms with very limit sram like rk3036 will return to bootrom after the dram initialized, they never use the malloc space. This few hundreds bytes is a large space for 4kb sarm, it's better to letf them for code or SP.
Since we're really size constrained here maybe it makes sense to move that print to a debug() ?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170704/e5ef8446/attachment.sig>
cover fix the boot issue of Rockchip RK3036
For what it’s worth: GCC 7.1 (in an aarch64-unknown-elf configuration) is now our default build-environment for our RK3399 and RK3368 boards and works as expected.
Quoted 63 lines · Tom Rini
Quoted 35 lines · Andy Yan
Hi Philipp:
Quoted 22 lines · Dr. Philipp Tomsich
Andy,
Quoted 20 lines · Andy Yan
As Kever mentioned in [0], the RK3036 based boards could't bootup for a long time.
After a git bisect, I found the RK3036 SPL code size has increased from patch [1] [2]. Before Tom's patch [1], the SPL size is 3160 bytes, but it becomes 4080 bytes after [1] applied. After a look at this patch, I realised I should disable SPL_USE_ARCH_MEMCPY/MEMSET, and the code size indeed come down after I disabled them. But I got a LD error after apply patch[2]: "undefined reference to memset", RK3036 SPL didn't use lib/string because of the sram space imitation. The compile succeed afterCONFIG_SPL_LIBGENERIC_SUPPORTenabled, but the spl code size become 3248 bytes.Additionally, Simon post patch [3] call printf to print a message before back to bootrom from spl, which make the spl code size increased to nearly 3.7 kb.
Quoted 8 lines
Quoted 3 lines
RK3036 SPL only has 4kb sram to use, the spl code will use 3.4 ~ 3.5 kb, the last 0.5kb are used for SP and GD, so there is no space for malloc.
gcc-6-arm-linux-gnueabi
What version of GCC are you using?
If your problem can also be solved by moving to GCC 6.3 (or newer) and the code-size improvements there, I’d rather just require a more recent GCC version.Quoted 5 lines
I default use arm-linux-gnueabe-gcc v5.4.
The current upstream kylin-rk3036_defconfig compiled by gcc-5.4
is 4384 bytes, the size comes down to 3936 bytes if I use arm-linux-gnueabihf-gcc v6.3 from linaro. But this is still too large for rk3036.Please note that (and U-Boot should be complaining at you) that with v2018.01 we'll be moving to gcc-6.x or later for ARM.
Quoted 10 lines
Disable SPL_USE_ARCH_MEMCPY/MEMSET will make the spl size comes
down to 3042 bytes by gcc v6.3. But I still need some hack: enableCONFIG_SPL_LIBGENERICto get support for memset, masks Simon's print inbootrom.c, or the code size will become very large. Event though this hack make things work, we still lost a few hundreds bytes by functionboard_init_f_alloc_reserve, because platforms with very limit sram like rk3036 will return to bootrom after the dram initialized, they never use the malloc space. This few hundreds bytes is a large space for 4kb sarm, it's better to letf them for code or SP.Since we're really size constrained here maybe it makes sense to move that print to a
debug()?Signature · 1 line
Tom
cover fix the boot issue of Rockchip RK3036
In reply to Tom RiniHi Tom:
Quoted 53 lines · Tom Rini
Quoted 34 lines · Andy Yan
Hi Philipp:
Quoted 22 lines · Dr. Philipp Tomsich
Andy,
Quoted 20 lines · Andy Yan
As Kever mentioned in [0], the RK3036 based boards could't bootup for a long time.
After a git bisect, I found the RK3036 SPL code size has increased from patch [1] [2]. Before Tom's patch [1], the SPL size is 3160 bytes, but it becomes 4080 bytes after [1] applied. After a look at this patch, I realised I should disable SPL_USE_ARCH_MEMCPY/MEMSET, and the code size indeed come down after I disabled them. But I got a LD error after apply patch[2]: "undefined reference to memset", RK3036 SPL didn't use lib/string because of the sram space imitation. The compile succeed afterCONFIG_SPL_LIBGENERIC_SUPPORTenabled, but the spl code size become 3248 bytes.Additionally, Simon post patch [3] call printf to print a message before back to bootrom from spl, which make the spl code size increased to nearly 3.7 kb.
Quoted 8 lines
Quoted 3 lines
RK3036 SPL only has 4kb sram to use, the spl code will use 3.4 ~ 3.5 kb, the last 0.5kb are used for SP and GD, so there is no space for malloc.
gcc-6-arm-linux-gnueabi
What version of GCC are you using?
If your problem can also be solved by moving to GCC 6.3 (or newer) and the code-size improvements there, I’d rather just require a more recent GCC version.Quoted 5 lines
I default use arm-linux-gnueabe-gcc v5.4.
The current upstream kylin-rk3036_defconfig compiled by gcc-5.4
is 4384 bytes, the size comes down to 3936 bytes if I use arm-linux-gnueabihf-gcc v6.3 from linaro. But this is still too large for rk3036.Please note that (and U-Boot should be complaining at you) that with v2018.01 we'll be moving to gcc-6.x or later for ARM.
Quoted 10 lines
Disable SPL_USE_ARCH_MEMCPY/MEMSET will make the spl size comes
down to 3042 bytes by gcc v6.3. But I still need some hack: enableCONFIG_SPL_LIBGENERICto get support for memset, masks Simon's print inbootrom.c, or the code size will become very large. Event though this hack make things work, we still lost a few hundreds bytes by functionboard_init_f_alloc_reserve, because platforms with very limit sram like rk3036 will return to bootrom after the dram initialized, they never use the malloc space. This few hundreds bytes is a large space for 4kb sarm, it's better to letf them for code or SP.
Quoted 3 lines
Since we're really size constrained here maybe it makes sense to move that print to a
debug()?
Yes, move it to debug() will mask the printf in normal. But even so,
we still lost a few hundreds bytes in function
board_init_f_alloc_reserve for malloc. RK3036 will returned to bootrom immediately after the sdram initialization, the few hundreds space for malloc pool is never used in SPL stage.
cover fix the boot issue of Rockchip RK3036
Quoted 60 lines · Andy Yan
Hi Tom:
Quoted 53 lines · Tom Rini
Quoted 34 lines · Andy Yan
Hi Philipp:
Quoted 22 lines · Dr. Philipp Tomsich
Andy,
Quoted 20 lines · Andy Yan
As Kever mentioned in [0], the RK3036 based boards could't bootup for a long time.
After a git bisect, I found the RK3036 SPL code size has increased from patch [1] [2]. Before Tom's patch [1], the SPL size is 3160 bytes, but it becomes 4080 bytes after [1] applied. After a look at this patch, I realised I should disable SPL_USE_ARCH_MEMCPY/MEMSET, and the code size indeed come down after I disabled them. But I got a LD error after apply patch[2]: "undefined reference to memset", RK3036 SPL didn't use lib/string because of the sram space imitation. The compile succeed afterCONFIG_SPL_LIBGENERIC_SUPPORTenabled, but the spl code size become 3248 bytes.Additionally, Simon post patch [3] call printf to print a message before back to bootrom from spl, which make the spl code size increased to nearly 3.7 kb.
Quoted 8 lines
Quoted 3 lines
RK3036 SPL only has 4kb sram to use, the spl code will use 3.4 ~ 3.5 kb, the last 0.5kb are used for SP and GD, so there is no space for malloc.
gcc-6-arm-linux-gnueabi
What version of GCC are you using?
If your problem can also be solved by moving to GCC 6.3 (or newer) and the code-size improvements there, I’d rather just require a more recent GCC version.Quoted 5 lines
I default use arm-linux-gnueabe-gcc v5.4.
The current upstream kylin-rk3036_defconfig compiled by gcc-5.4
is 4384 bytes, the size comes down to 3936 bytes if I use arm-linux-gnueabihf-gcc v6.3 from linaro. But this is still too large for rk3036.Please note that (and U-Boot should be complaining at you) that with v2018.01 we'll be moving to gcc-6.x or later for ARM.
Quoted 10 lines
Disable SPL_USE_ARCH_MEMCPY/MEMSET will make the spl size comes
down to 3042 bytes by gcc v6.3. But I still need some hack: enableCONFIG_SPL_LIBGENERICto get support for memset, masks Simon's print inbootrom.c, or the code size will become very large. Event though this hack make things work, we still lost a few hundreds bytes by functionboard_init_f_alloc_reserve, because platforms with very limit sram like rk3036 will return to bootrom after the dram initialized, they never use the malloc space. This few hundreds bytes is a large space for 4kb sarm, it's better to letf them for code or SP.Quoted 3 lines
Since we're really size constrained here maybe it makes sense to move that print to a
debug()?
Quoted 6 lines
Yes, move it to
debug()will mask the printf in normal. But even
so, we still lost a few hundreds bytes in function
board_init_f_alloc_reservefor malloc. RK3036 will returned to bootrom immediately after the sdram initialization, the few hundreds space for malloc pool is never used in SPL stage.
Can you work the code paths out such that board_init_f_alloc_reserve would not be called then?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170704/3b939319/attachment.sig>
cover fix the boot issue of Rockchip RK3036
Hi Tom:
Quoted 61 lines · Tom Rini
Quoted 60 lines · Andy Yan
Hi Tom:
Quoted 56 lines · Tom Rini
Quoted 34 lines · Andy Yan
Hi Philipp:
Quoted 22 lines · Dr. Philipp Tomsich
Andy,
Quoted 20 lines · Andy Yan
As Kever mentioned in [0], the RK3036 based boards could't bootup for a long time.
After a git bisect, I found the RK3036 SPL code size has increased from patch [1] [2]. Before Tom's patch [1], the SPL size is 3160 bytes, but it becomes 4080 bytes after [1] applied. After a look at this patch, I realised I should disable SPL_USE_ARCH_MEMCPY/MEMSET, and the code size indeed come down after I disabled them. But I got a LD error after apply patch[2]: "undefined reference to memset", RK3036 SPL didn't use lib/string because of the sram space imitation. The compile succeed afterCONFIG_SPL_LIBGENERIC_SUPPORTenabled, but the spl code size become 3248 bytes.Additionally, Simon post patch [3] call printf to print a message before back to bootrom from spl, which make the spl code size increased to nearly 3.7 kb.
Quoted 8 lines
Quoted 3 lines
RK3036 SPL only has 4kb sram to use, the spl code will use 3.4 ~ 3.5 kb, the last 0.5kb are used for SP and GD, so there is no space for malloc.
gcc-6-arm-linux-gnueabi
What version of GCC are you using?
If your problem can also be solved by moving to GCC 6.3 (or newer) and the code-size improvements there, I’d rather just require a more recent GCC version.Quoted 5 lines
I default use arm-linux-gnueabe-gcc v5.4.
The current upstream kylin-rk3036_defconfig compiled by gcc-5.4
is 4384 bytes, the size comes down to 3936 bytes if I use arm-linux-gnueabihf-gcc v6.3 from linaro. But this is still too large for rk3036.Please note that (and U-Boot should be complaining at you) that with v2018.01 we'll be moving to gcc-6.x or later for ARM.
Quoted 10 lines
Disable SPL_USE_ARCH_MEMCPY/MEMSET will make the spl size comes
down to 3042 bytes by gcc v6.3. But I still need some hack: enableCONFIG_SPL_LIBGENERICto get support for memset, masks Simon's print inbootrom.c, or the code size will become very large. Event though this hack make things work, we still lost a few hundreds bytes by functionboard_init_f_alloc_reserve, because platforms with very limit sram like rk3036 will return to bootrom after the dram initialized, they never use the malloc space. This few hundreds bytes is a large space for 4kb sarm, it's better to letf them for code or SP.Since we're really size constrained here maybe it makes sense to move that print to a
debug()?
Quoted 9 lines
Quoted 6 lines
Yes, move it to
debug()will mask the printf in normal. But even
so, we still lost a few hundreds bytes in function
board_init_f_alloc_reservefor malloc. RK3036 will returned to bootrom immediately after the sdram initialization, the few hundreds space for malloc pool is never used in SPL stage.Can you work the code paths out such that
board_init_f_alloc_reservewould not be called then?
board_init_f_alloc_reserve is called from crt0.S, in not so easy to work the code path out. And board_init_f_alloc_reserve also reserve space for GD, this is we needed. So I want make this function as weak, then I can override it in my board spl state.
cover fix the boot issue of Rockchip RK3036
Quoted 71 lines · Andy Yan
Hi Tom:
Quoted 67 lines · Tom Rini
Quoted 66 lines · Andy Yan
Hi Tom:
Quoted 53 lines · Tom Rini
Quoted 34 lines · Andy Yan
Hi Philipp:
Quoted 22 lines · Dr. Philipp Tomsich
Andy,
Quoted 20 lines · Andy Yan
As Kever mentioned in [0], the RK3036 based boards could't bootup for a long time.
After a git bisect, I found the RK3036 SPL code size has increased from patch [1] [2]. Before Tom's patch [1], the SPL size is 3160 bytes, but it becomes 4080 bytes after [1] applied. After a look at this patch, I realised I should disable SPL_USE_ARCH_MEMCPY/MEMSET, and the code size indeed come down after I disabled them. But I got a LD error after apply patch[2]: "undefined reference to memset", RK3036 SPL didn't use lib/string because of the sram space imitation. The compile succeed afterCONFIG_SPL_LIBGENERIC_SUPPORTenabled, but the spl code size become 3248 bytes.Additionally, Simon post patch [3] call printf to print a message before back to bootrom from spl, which make the spl code size increased to nearly 3.7 kb.
Quoted 8 lines
Quoted 3 lines
RK3036 SPL only has 4kb sram to use, the spl code will use 3.4 ~ 3.5 kb, the last 0.5kb are used for SP and GD, so there is no space for malloc.
gcc-6-arm-linux-gnueabi
What version of GCC are you using?
If your problem can also be solved by moving to GCC 6.3 (or newer) and the code-size improvements there, I’d rather just require a more recent GCC version.Quoted 5 lines
I default use arm-linux-gnueabe-gcc v5.4.
The current upstream kylin-rk3036_defconfig compiled by gcc-5.4
is 4384 bytes, the size comes down to 3936 bytes if I use arm-linux-gnueabihf-gcc v6.3 from linaro. But this is still too large for rk3036.Please note that (and U-Boot should be complaining at you) that with v2018.01 we'll be moving to gcc-6.x or later for ARM.
Quoted 10 lines
Disable SPL_USE_ARCH_MEMCPY/MEMSET will make the spl size comes
down to 3042 bytes by gcc v6.3. But I still need some hack: enableCONFIG_SPL_LIBGENERICto get support for memset, masks Simon's print inbootrom.c, or the code size will become very large. Event though this hack make things work, we still lost a few hundreds bytes by functionboard_init_f_alloc_reserve, because platforms with very limit sram like rk3036 will return to bootrom after the dram initialized, they never use the malloc space. This few hundreds bytes is a large space for 4kb sarm, it's better to letf them for code or SP.Quoted 3 lines
Since we're really size constrained here maybe it makes sense to move that print to a
debug()?Yes, move it to
debug()will mask the printf in normal. But even
so, we still lost a few hundreds bytes in function
board_init_f_alloc_reservefor malloc. RK3036 will returned to bootrom immediately after the sdram initialization, the few hundreds space for malloc pool is never used in SPL stage.
Quoted 7 lines
Quoted 2 lines
Can you work the code paths out such that
board_init_f_alloc_reservewould not be called then?
board_init_f_alloc_reserveis called fromcrt0.S, in not so easy to work the code path out. Andboard_init_f_alloc_reservealso reserve space for GD, this is we needed. So I want make this function as weak, then I can override it in my board spl state.
Sounds like a reasonable path to explore, thanks.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170706/9cf305a9/attachment.sig>
cover fix the boot issue of Rockchip RK3036
In reply to Andy YanHi Andy,
Am Montag, 3. Juli 2017, 16:02:59 CEST schrieb Andy Yan:
Quoted 29 lines · Dr. Philipp Tomsich
Quoted 22 lines
Quoted 14 lines · Andy Yan
As Kever mentioned in [0], the RK3036 based boards could't bootup for a long time.
After a git bisect, I found the RK3036 SPL code size has increased from patch [1] [2]. Before Tom's patch [1], the SPL size is 3160 bytes, but it becomes 4080 bytes after [1] applied. After a look at this patch, I realised I should disable SPL_USE_ARCH_MEMCPY/MEMSET, and the code size indeed come down after I disabled them. But I got a LD error after apply patch[2]: "undefined reference to memset", RK3036 SPL didn't use lib/string because of the sram space imitation. The compile succeed afterCONFIG_SPL_LIBGENERIC_SUPPORTenabled, but the spl code size become 3248 bytes.Quoted 7 lines
Additionally, Simon post patch [3] call printf to print a message before back to bootrom from spl, which make the spl code size increased to nearly 3.7 kb.
RK3036 SPL only has 4kb sram to use, the spl code will use 3.4 ~ 3.5 kb, the last 0.5kb are used for SP and GD, so there is no space for malloc.
Quoted 5 lines
gcc-6-arm-linux-gnueabi
What version of GCC are you using?
If your problem can also be solved by moving to GCC 6.3 (or newer) and the code-size improvements there, I’d rather just require a more recent GCC version.
Quoted 14 lines
I default use arm-linux-gnueabe-gcc v5.4.
The current upstream kylin-rk3036_defconfig compiled by gcc-5.4 is
4384 bytes, the size comes down to 3936 bytes if I use arm-linux-gnueabihf-gcc v6.3 from linaro. But this is still too large for rk3036.
Disable SPL_USE_ARCH_MEMCPY/MEMSET will make the spl size comes
down to 3042 bytes by gcc v6.3. But I still need some hack: enableCONFIG_SPL_LIBGENERICto get support for memset, masks Simon's print inbootrom.c, or the code size will become very large. Event though this hack make things work, we still lost a few hundreds bytes by functionboard_init_f_alloc_reserve, because platforms with very limit sram like rk3036 will return to bootrom after the dram initialized, they never use the malloc space. This few hundreds bytes is a large space for 4kb sarm, it's better to letf them for code or SP.
For a start, maybe you could take a look at Simon's size reduction series from april. The TPL-specific stuff may not be that interesting, but the first patch adds a totally slimmed down memset, which may be better for real hard size constraints
[PATCH v2 0/5] Patches to reduce TPL code size:
https://www.mail-archive.com/u-boot at lists.denx.de/msg243443.html
Heiko
cover fix the boot issue of Rockchip RK3036
Hi Heiko:
Quoted 44 lines · Heiko Stübner
Hi Andy,
Am Montag, 3. Juli 2017, 16:02:59 CEST schrieb Andy Yan:
Quoted 27 lines · Dr. Philipp Tomsich
Quoted 18 lines
Quoted 18 lines · Andy Yan
As Kever mentioned in [0], the RK3036 based boards could't bootup for a long time.
After a git bisect, I found the RK3036 SPL code size has increased from patch [1] [2]. Before Tom's patch [1], the SPL size is 3160 bytes, but it becomes 4080 bytes after [1] applied. After a look at this patch, I realised I should disable SPL_USE_ARCH_MEMCPY/MEMSET, and the code size indeed come down after I disabled them. But I got a LD error after apply patch[2]: "undefined reference to memset", RK3036 SPL didn't use lib/string because of the sram space imitation. The compile succeed afterCONFIG_SPL_LIBGENERIC_SUPPORTenabled, but the spl code size become 3248 bytes.Additionally, Simon post patch [3] call printf to print a message before back to bootrom from spl, which make the spl code size increased to nearly 3.7 kb.
Quoted 8 lines
Quoted 3 lines
RK3036 SPL only has 4kb sram to use, the spl code will use 3.4 ~ 3.5 kb, the last 0.5kb are used for SP and GD, so there is no space for malloc.
gcc-6-arm-linux-gnueabi
What version of GCC are you using?
If your problem can also be solved by moving to GCC 6.3 (or newer) and the code-size improvements there, I’d rather just require a more recent GCC version.Quoted 14 lines
I default use arm-linux-gnueabe-gcc v5.4.
The current upstream kylin-rk3036_defconfig compiled by gcc-5.4 is
4384 bytes, the size comes down to 3936 bytes if I use arm-linux-gnueabihf-gcc v6.3 from linaro. But this is still too large for rk3036.
Disable SPL_USE_ARCH_MEMCPY/MEMSET will make the spl size comes
down to 3042 bytes by gcc v6.3. But I still need some hack: enableCONFIG_SPL_LIBGENERICto get support for memset, masks Simon's print inbootrom.c, or the code size will become very large. Event though this hack make things work, we still lost a few hundreds bytes by functionboard_init_f_alloc_reserve, because platforms with very limit sram like rk3036 will return to bootrom after the dram initialized, they never use the malloc space. This few hundreds bytes is a large space for 4kb sarm, it's better to letf them for code or SP.Heiko
Quoted 7 lines
For a start, maybe you could take a look at Simon's size reduction series from april. The TPL-specific stuff may not be that interesting, but the first patch adds a totally slimmed down memset, which may be better for real hard size constraints
[PATCH v2 0/5] Patches to reduce TPL code size:
https://www.mail-archive.com/u-boot at lists.denx.de/msg243443.html
The SPL_TINY_MEMSET was included in my hack.
Quoted 7 lines
Heiko
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CAPnjgZ0p5URtKor3-UE=-bAHuXBsyy25_z13Pj+c-kz1QH_wZw@mail.gmail.com
PATCH 1/5 board_init.c: make the reserve functions as weak
Hi Simon:
Quoted 13 lines · Simon Glass
Hi Andy,
Quoted 10 lines · Andy Yan
Some platform like rk3036 has no enough sapce for malloc and also has no necessary to use malloc function in spl stage. But the malloc pool is need in u-boot stage before relocation.Make the reserve functions as weak, so we can override it with a no malloc reserve in spl stage and use the weak function to reserve malloc pool in u-boot stage.
Signed-off-by Andy Yan <[email protected]>
Quoted 7 lines
Quoted 4 lines
---
common/init/board_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)I am not keen on weak functions for this sort of thing.
Can we instead be explicit and introduce a new control
CONFIG_SPL_SYS_MALLOC_F?
I also have this ideas, but with a grep I found theCONFIG_SYS_MALLOC_F_LEN is spread all over the project. So maybe it's a little hard to seperate it. Anyway, I will have a try.
Quoted 6 lines
Regards,
Simon