Simon Goldschmidt | c272283 | 2019-05-24 22:07:04 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (c) 2019, Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> |
| 4 | * |
| 5 | * This tool helps to return the size available for SPL image during build |
| 6 | */ |
| 7 | |
| 8 | #include <generated/autoconf.h> |
| 9 | #include <generated/generic-asm-offsets.h> |
| 10 | |
| 11 | int main(int argc, char *argv[]) |
| 12 | { |
| 13 | int spl_size_limit = 0; |
| 14 | |
| 15 | #ifdef CONFIG_SPL_SIZE_LIMIT |
| 16 | spl_size_limit = CONFIG_SPL_SIZE_LIMIT; |
Stefano Babic | f8b509b | 2019-09-20 08:47:53 +0200 | [diff] [blame] | 17 | #if defined(CONFIG_IMX_HAB) && defined(CONFIG_CSF_SIZE) |
Breno Matheus Lima | e46456e | 2019-07-18 12:34:23 +0000 | [diff] [blame] | 18 | spl_size_limit -= CONFIG_CSF_SIZE; |
| 19 | #endif |
Simon Goldschmidt | c272283 | 2019-05-24 22:07:04 +0200 | [diff] [blame] | 20 | #ifdef CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD |
| 21 | spl_size_limit -= GENERATED_GBL_DATA_SIZE; |
| 22 | #endif |
| 23 | #ifdef CONFIG_SPL_SIZE_LIMIT_SUBTRACT_MALLOC |
| 24 | spl_size_limit -= CONFIG_SPL_SYS_MALLOC_F_LEN; |
| 25 | #endif |
| 26 | #ifdef CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK |
| 27 | spl_size_limit -= CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK; |
| 28 | #endif |
| 29 | #endif |
| 30 | |
| 31 | printf("%d", spl_size_limit); |
| 32 | return 0; |
| 33 | } |