Blame view

tools/spl_size_limit.c 854 Bytes
2577015dc   Simon Goldschmidt   spl: add overall ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  // SPDX-License-Identifier: GPL-2.0+
  /*
   * Copyright (c) 2019, Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
   *
   * This tool helps to return the size available for SPL image during build
   */
  
  #include <generated/autoconf.h>
  #include <generated/generic-asm-offsets.h>
  
  int main(int argc, char *argv[])
  {
  	int spl_size_limit = 0;
  
  #ifdef CONFIG_SPL_SIZE_LIMIT
  	spl_size_limit = CONFIG_SPL_SIZE_LIMIT;
d714a75fd   Stefano Babic   imx: replace CONF...
17
  #if defined(CONFIG_IMX_HAB) && defined(CONFIG_CSF_SIZE)
717143716   Breno Matheus Lima   imx6: spl: Reduce...
18
19
  	spl_size_limit -= CONFIG_CSF_SIZE;
  #endif
2577015dc   Simon Goldschmidt   spl: add overall ...
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  #ifdef CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD
  	spl_size_limit -= GENERATED_GBL_DATA_SIZE;
  #endif
  #ifdef CONFIG_SPL_SIZE_LIMIT_SUBTRACT_MALLOC
  	spl_size_limit -= CONFIG_SPL_SYS_MALLOC_F_LEN;
  #endif
  #ifdef CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK
  	spl_size_limit -= CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK;
  #endif
  #endif
  
  	printf("%d", spl_size_limit);
  	return 0;
  }