Commit graph

314 commits

Author SHA1 Message Date
Mark Dykes
04b2fb42b1 Merge "feat(rk3576): support rk3576" into integration 2025-02-25 21:53:45 +01:00
Yann Gautier
dae7d72984 Merge "feat(rockchip): increase FDT Buffer for Rockchip Devices" into integration 2025-02-24 09:18:52 +01:00
XiaoDong Huang
036935a814 feat(rk3576): support rk3576
rk3576 is an Octa-core soc with Cortex-a53/a72 inside.
This patch supports the following functions:
1. basic platform setup
2. power up/off cpus
3. suspend/resume cpus
4. suspend/resume system
5. reset system
6. power off system

Change-Id: I67a019822bd4af13e4a3cdd09cf06202f4922cc4
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
2025-02-24 15:07:43 +08:00
Chris Morgan
ab99dce4b7 feat(rockchip): increase FDT Buffer for Rockchip Devices
Modify the FDT buffer for Rockchip devices to 384KiB. This is done to
allow us to pass mainline devicetrees with symbols through Arm Trusted
Firmware. 384KiB was chosen as 512KiB is very near the maximum
supported with the current reserved memory. As of kernel version 6.13,
the largest devicetree with symbols enabled is 215KiB, and the largest
Rockchip devicetree with symbols enabled is 176KiB
(rk3588-evb1-v10.dtb).

Change-Id: Iea9343d7a30ee26cad3ee5cc848980a93873ae34
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
2025-02-18 17:22:03 +01:00
Jens Wiklander
6d7f1d4945 feat(rockchip): update uart baudrate for rk3399
Set the UART baudrate to 1500000 since that is what the ROM code and
other components use. This reverts the change of baudrate in the commit
0c05748bde ("rockchip: fixes for the required") and enables logging
from BL31 and OP-TEE during boot and after the kernel has booted.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Change-Id: I5b5db25b069f3676ebb9dba2fa778601e05f1334
2025-02-12 11:22:45 +01:00
Boyan Karatotev
db5fe4f493 chore(docs): drop the "wfi" from pwr_domain_pwr_down_wfi
To allow for generic handling of a wakeup, this hook is no longer
expected to call wfi itself. Update the name everywhere to reflect this
expectation so that future platform implementers don't get misled.

Change-Id: Ic33f0b6da74592ad6778fd802c2f0b85223af614
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
2025-02-03 14:29:47 +00:00
Boyan Karatotev
2bd3b39767 refactor: panic after calling psci_power_down_wfi()
This function doesn't return and its callers that don't return either
rely on this. Drop the dead attribute and add a panic() after it to make
this expectation explicit. Calling `wfi` in the powerdown sequence is
terminal so even if the function was made to return, there would be no
functional change.

This is useful for a following patch that makes psci_power_down_wfi()
return.

Change-Id: I62ca1ee058b1eaeb046966c795081e01bf45a2eb
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
2025-02-03 14:29:47 +00:00
Quentin Schulz
ddd70f199b fix(rk3399): fix unquoted .incbin for clang
While GCC doesn't complain about anything for .incbin, clang does:
"""
<instantiation>:6:10: error: expected string in '.incbin' directive
 .incbin /build/rk3399/release/m0/rk3399m0.bin
         ^
plat/rockchip/rk3399/drivers/pmu/pmu_fw.S:20:1: note: while in macro instantiation
INCBIN """/build/rk3399/release/m0/rk3399m0.bin""", "rk3399m0_bin", ".sram.incbin"
^
<instantiation>:6:10: error: expected string in '.incbin' directive
 .incbin /build/rk3399/release/m0/rk3399m0pmu.bin
         ^
plat/rockchip/rk3399/drivers/pmu/pmu_fw.S:21:1: note: while in macro instantiation
INCBIN """/build/rk3399/release/m0/rk3399m0pmu.bin""", "rk3399m0pmu_bin", ".pmusram.incbin"
^
"""

Adding quotes around \file in .incbin fixes the clang issue but GCC now
complains:
"""
plat/rockchip/rk3399/drivers/pmu/pmu_fw.S: Assembler messages:
plat/rockchip/rk3399/drivers/pmu/pmu_fw.S:14: Error: junk at end of line, first unrecognized character is `/'
plat/rockchip/rk3399/drivers/pmu/pmu_fw.S:20:  Info: macro invoked from here
plat/rockchip/rk3399/drivers/pmu/pmu_fw.S:14: Error: unable to include `./'
plat/rockchip/rk3399/drivers/pmu/pmu_fw.S:20:  Info: macro invoked from here
plat/rockchip/rk3399/drivers/pmu/pmu_fw.S:14: Error: junk at end of line, first unrecognized character is `/'
plat/rockchip/rk3399/drivers/pmu/pmu_fw.S:21:  Info: macro invoked from here
plat/rockchip/rk3399/drivers/pmu/pmu_fw.S:14: Error: unable to include `./'
plat/rockchip/rk3399/drivers/pmu/pmu_fw.S:21:  Info: macro invoked from here
"""

Considering that the symbol is defined with escaped quotes, it is
probably safe to remove the double quotes around the INBCIN macro
parameter, so let's do that to make both compilers happy.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Change-Id: Id18b0341353ffc00e44e2d3c643ccdd05cc20c4f
2024-12-13 18:01:53 +01:00
Chris Kay
279cad8ed3 fix(rk3399): mark INCBIN-generated sections as SHF_ALLOC
When assembling with Clang, sections generated via the `INCBIN` macro
are not assigned the `SHF_ALLOC` attribute, and the linker therefore
does not know to include them in the binary.

This change is simple: explicitly tell the assembler that the section
should have the `SHF_ALLOC` attribute.

For reference: https://man7.org/linux/man-pages/man5/elf.5.html

>   SHF_ALLOC
>       This section occupies memory during process execution. Some
>       control sections do not reside in the memory image of an object
>       file. This attribute is off for those sections.

Change-Id: I626162eae9030b5ffbd03af2be76f89a248af9ca
Signed-off-by: Chris Kay <chris.kay@arm.com>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
2024-12-13 18:01:49 +01:00
Manish Pandey
cb4562e05e Merge changes from topic "clang-rockchip" into integration
* changes:
  build(rk3399): m0: Makefile: respect verbosity for linkerfile
  build(rk3399): m0: fail linker and assembler on warnings
  build(rk3399): m0: remove redundant M0_CROSS_COMPILE
  feat(build): rk3399: m0: add support for new binutils versions
  fix(rk3399): m0: Makefile: fix outside array bounds warning
  refactor(rk3399): m0: Makefile: use same tools as in build_macros.mk
  refactor(rk3399): m0: Makefile: specify ARCH to be rk3399-m0
  fix(rk3588): pmu: fix assembly symbol redefinition
  fix(rockchip): pmu: Do not mark already defined functions as weak
  fix(rk3399): dram: Fix build with gcc 11
  fix(rk3288): remove unused function
  fix(px30): remove unused function
2024-12-13 17:36:10 +01:00
Chris Kay
daab00cf29 build: disable suffix rules globally
This change centralises the logic that disables the default suffix rules
that Make provides. These rules are a hold-over from legacy standards of
Make, and occasionally conflict with our rules.

Change-Id: I9e023edbc01b5ae48a96fa1078d0b81faabb0cb9
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-11-25 15:40:35 +00:00
Quentin Schulz
e53fc0404b build(rk3399): m0: Makefile: respect verbosity for linkerfile
All commands in the Makefile respect the verbosity except this one, so
let's be consistent and respect it for that one as well.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Change-Id: I5d1af4ee321e29449b927509cfa5ece01765a99e
2024-11-05 14:28:47 +01:00
Quentin Schulz
c0c908e13b build(rk3399): m0: fail linker and assembler on warnings
Match the top Makefile flags and fail on warnings for the linker (ld)
and assembler (as).

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Change-Id: I53fbcbdbda109b1dfe39b390a41c1ef3fd7d3e04
2024-11-05 14:28:42 +01:00
Quentin Schulz
6feb164b53 build(rk3399): m0: remove redundant M0_CROSS_COMPILE
The included toolchain.mk uses M0_CROSS_COMPILE if present, or defaults
to arm-none-eabi-, which is the value this variable holds in this
Makefile.

Let's remove it.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Change-Id: Id805703cec0f118acdf4629e345924031b2c8c4b
2024-11-05 14:28:38 +01:00
Quentin Schulz
6fbec46a59 feat(build): rk3399: m0: add support for new binutils versions
c.f. 1f49db5f25 ("feat(build): add support for new binutils versions")
for the actual reasons. This commit applies the same logic but for the
m0 FW for RK3399 since it uses a different set of flags.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Change-Id: I955b229a7d9d473892f3f3483eaf6e33ffe0e273
2024-11-05 14:28:34 +01:00
Quentin Schulz
5049f910ae fix(rk3399): m0: Makefile: fix outside array bounds warning
Both GCC and clang actually complain about:

"""
In file included from src/dram.c:12:
src/dram.c: In function 'm0_main':
include/rk3399_mcu.h:15:34: warning: array subscript 0 is outside array bounds of 'volatile unsigned int[0]' [-Warray-bounds=]
   15 |                                 (*(volatile unsigned int *)(c)); __v; })
      |                                 ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/rk3399_mcu.h:16:69: note: in definition of macro 'mmio_write_32'
   16 | #define mmio_write_32(c, v)     ((*(volatile unsigned int *)(c)) = (v))
      |     ^
src/dram.c:67:23: note: in expansion of macro 'mmio_read_32'
   67 |                       mmio_read_32(PARAM_ADDR + PARAM_FREQ_SELECT));
      |                       ^~~~~~~~~~~~
cc1: note: source object is likely at address zero
In function 'ddr_set_pll',
    inlined from 'm0_main' at src/dram.c:71:2:
include/rk3399_mcu.h:14:40: warning: array subscript 0 is outside array bounds of 'volatile unsigned int[0]' [-Warray-bounds=]
   14 | #define mmio_read_32(c) ({unsigned int __v = \
      |                                        ^~~
include/rk3399_mcu.h:16:69: note: in definition of macro 'mmio_write_32'
   16 | #define mmio_write_32(c, v)     ((*(volatile unsigned int *)(c)) = (v))
      |     ^
src/dram.c:47:23: note: in expansion of macro 'mmio_read_32'
   47 |                       mmio_read_32(PARAM_ADDR + PARAM_DPLL_CON0));
      |                       ^~~~~~~~~~~~
In function 'm0_main':
cc1: note: source object is likely at address zero
In function 'ddr_set_pll',
    inlined from 'm0_main' at src/dram.c:71:2:
include/rk3399_mcu.h:14:40: warning: array subscript 0 is outside array bounds of 'volatile unsigned int[0]' [-Warray-bounds=]
   14 | #define mmio_read_32(c) ({unsigned int __v = \
      |                                        ^~~
include/rk3399_mcu.h:16:69: note: in definition of macro 'mmio_write_32'
   16 | #define mmio_write_32(c, v)     ((*(volatile unsigned int *)(c)) = (v))
      |     ^
src/dram.c:49:23: note: in expansion of macro 'mmio_read_32'
   49 |                       mmio_read_32(PARAM_ADDR + PARAM_DPLL_CON1));
      |                       ^~~~~~~~~~~~
In function 'm0_main':
cc1: note: source object is likely at address zero
include/rk3399_mcu.h:16:35: warning: array subscript 0 is outside array bounds of 'volatile unsigned int[0]' [-Warray-bounds=]
   16 | #define mmio_write_32(c, v)     ((*(volatile unsigned int *)(c)) = (v))
      |                                  ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/dram.c:80:9: note: in expansion of macro 'mmio_write_32'
   80 |         mmio_write_32(PARAM_ADDR + PARAM_M0_DONE, M0_DONE_FLAG);
      |         ^~~~~~~~~~~~~
cc1: note: source object is likely at address zero
"""

The global Makefile defines --param=min-pagesize=0 already, so let's
just apply the same fix for the m0 part of the RK3399 binary.

Suggested-by: Boyan Karatotev <boyan.karatotev@arm.com>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Change-Id: I4f29a579b9e4b01aa2540746ef46e2a382f0012e
2024-11-05 14:28:27 +01:00
Quentin Schulz
efe45dd532 refactor(rk3399): m0: Makefile: use same tools as in build_macros.mk
This should make it easier to spot mistakes or reuse rules by comparing
this Makefile with build_macros.mk.

Additionally, this allows to provide flags that aren't supported by CC
(e.g. --no-warn-rwx-segments).

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Change-Id: Iba121d53959ff4f8bd10a14280c4d93a710dc9db
2024-11-05 14:28:23 +01:00
Quentin Schulz
87577afeb8 refactor(rk3399): m0: Makefile: specify ARCH to be rk3399-m0
cortex-m0 is not a recognized ARCH in our build system so most macros
need to be redefined to use hardcoded strings which isn't ideal.

While this now has limited use-case, a future commit will allow to make
use of this fixed variable via macros.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Change-Id: I6d1e588d2ab27d7a60f32e5369370c43d68b3a20
2024-11-05 14:28:11 +01:00
Quentin Schulz
f879388831 fix(rk3588): pmu: fix assembly symbol redefinition
Somehow cpus_pd_req_enter_wfi() gets called multiple times and clang
isn't happy about redefining the same label multiple times (it is an
inline function).

An option could be to force the code to not be inlined (with
__attribute__((noinline))) as removing the explicit inline still made
the compiler inline the code.

This is not an issue on GCC because the compiler doesn't respect the
inline request[1]. If the function is forced inlined with
inline __attribute__((__always_inline__)), the same build issue as found
on clang happens for GCC.

Use a local label[2] instead and make the branch instruction use the
latest previously defined local label instead, so that clang is happy
and the code is consistent with other assembly instructions in this file
which all use local labels.

This gets rid of the following build error on clang:
plat/rockchip/rk3588/drivers/pmu/pmu.c:763:7: error: symbol 'wfi_loop' is already defined
  763 |                           "wfi_loop:\n"
      |                            ^
<inline asm>:5:1: note: instantiated into assembly here
    5 | wfi_loop:
      | ^

[1] https://www.kernel.org/doc/local/inline.html
[2] https://sourceware.org/binutils/docs/as/Symbol-Names.html Local Labels section
Suggested-by: Boyan Karatotev <boyan.karatotev@arm.com>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Change-Id: Ie9f55135b2f95a78deb7cbb94f9a62d3ba61e808
2024-11-05 14:27:56 +01:00
Khem Raj
7f25d3cc78 fix(rockchip): pmu: Do not mark already defined functions as weak
These functions are already defined as static functions in same header
Fixes

| plat/rockchip/common/drivers/pmu/pmu_com.h:35:14: error: weak identifier 'pmu_power_domain_ctr' never declared [-Werror]
| #pragma weak pmu_power_domain_ctr
|              ^
| plat/rockchip/common/drivers/pmu/pmu_com.h:36:14: error: weak identifier 'check_cpu_wfie' never declared [-Werror]
| #pragma weak check_cpu_wfie
|              ^

Signed-off-by: Khem Raj <raj.khem@gmail.com>
[fixed alignment in commit log]
[added fix(rockchip): prefix in commit title]
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Change-Id: I96d4acbe743ba4b8996f0be0fa713b341bd4903c
2024-11-05 14:27:54 +01:00
Khem Raj
f86c230ab0 fix(rk3399): dram: Fix build with gcc 11
This is a redundant assignment which GCC warns about.

Fixes

plat/rockchip/rk3399/drivers/dram/dram_spec_timing.c:781:11: error: explicitly assigning value of variable of type 'uint32_t' (aka 'unsigned int') to itself [-Werror,-Wself-assign]
                twr_tmp = twr_tmp;
                ~~~~~~~ ^ ~~~~~~~

Signed-off-by: Khem Raj <raj.khem@gmail.com>
[add fix(rk3399): prefix to commit title]
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Change-Id: Ib12281e0720346ffe68e81a24ea772ddc89d4f83
2024-11-05 14:27:36 +01:00
Quentin Schulz
6e38cc97df fix(rk3288): remove unused function
clang complains about it and refuses to build otherwise, so let's remove
this seemingly unused function.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Change-Id: Ie81b014feccfb93984fbf776dc69ca493cea89d0
2024-11-05 14:27:11 +01:00
Quentin Schulz
ce66647681 fix(px30): remove unused function
clang complains about it and refuses to build otherwise, so let's remove
this seemingly unused function.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Change-Id: Ifdf42308a76e8990e08f504fa58989d4cac7e434
2024-11-05 14:26:50 +01:00
mojyack
52cdebbcc5 fix(rockchip): fix "unexpected token" error with clang
Change-Id: I5be872c882801d170af4511b2289b77a13395162
Signed-off-by: mojyack <mojyack@gmail.com>
2024-10-18 22:43:43 +02:00
Manish V Badarkhe
1297a45d6a Merge changes from topic "dynamic-toolchain" into integration
* changes:
  build: allow multiple toolchain defaults
  build: determine toolchain tools dynamically
2024-09-25 13:53:54 +02:00
XiaoDong Huang
b833bbe6f0 feat(rk3588): enable crypto function
The CPU crypto is not default on when power up, need to enable it by
software.

Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
Change-Id: Ifee2eab55d9c13cef5f15926fb80016845e2a66d
2024-09-18 19:59:10 +08:00
Chris Kay
3789c3c000 build: determine toolchain tools dynamically
Since the introduction of the toolchain detection framework into the
build system, we have done determination and identification of the
toolchain(s) used for the build at the initialization of the build
system.

This incurs a large cost to the build every time - for every toolchain
that has been requested by the current makefile, we try to identify each
tool in the list of known tool classes, even if that tool doesn't
actually see any use.

For the clean and check-like targets we worked around this by disabling
most of the toolchains if we detect these targets, but this is
inflexible and not very reliable, and it still means that when building
normal targets we are incurring that cost for all tools whether they are
used or not.

This change instead modifies the toolchain detection framework to only
initialize a tool for a given toolchain when it is first used. This does
mean that we can no longer warn about an incorrectly-configured
toolchain at the beginning of build system invocation, but it has the
advantage of substantially reducing build time and the complexity of
*using* the framework (at the cost of an increase in complexity in the
framework itself).

Change-Id: I7f3d06b2eb58c1b26a846791a13b0037f32c8013
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-09-10 09:47:06 +00:00
XiaoDong Huang
04150fee44 feat(rk3588): support SCMI for clock/reset domain
rockchip scmi clock controls clocks which only available in secure mode.

Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
Change-Id: I5b983877a5b4e8acababbf7e0a3e2725e6479e08
2024-08-13 15:45:37 +08:00
XiaoDong Huang
e3ec6ff4b2 feat(rk3588): support rk3588
rk3588 is an Octa-core soc with Cortex-a55/a76 inside.
This patch supports the following functions:
1. basic platform setup
2. power up/off cpus
3. suspend/resume cpus
4. suspend/resume system
5. reset system
6. power off system

Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
Change-Id: I598109f15a2efd5b33aedd176cf708c08cb1dcf4
2024-08-13 14:26:04 +08:00
Chris Kay
f4dd18c270 build: consolidate directory creation rules
This commit streamlines directory creation by introducing a single
pattern rule to automatically make directories for which there is a
dependency.

We currently use several macros to generate rules to create directories
upon dependence, which is a significant amount of code and a lot of
redundancy. The rule introduced by this change represents a catch-all:
any rule dependency on a path ending in a forward slash is automatically
created.

Now, rules can rely on an unordered dependency (`|`) on `$$(@D)/` which,
when secondary expansion is enabled, expands to the directory of the
target being built, e.g.:

    build/main.o: main.c | $$(@D)/ # automatically creates `build/`

Change-Id: I7e554efa2ac850e779bb302fd9c7fbb239886c9f
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-07-22 09:41:30 +00:00
André Przywara
a19ee8da03 Merge changes from topic "rockchip" into integration
* changes:
  fix(rockchip): add parenthesis for BITS_SHIFT macro
  fix(rockchip): xlat: fix compatibility between v1 and v2
2024-06-20 11:40:36 +02:00
XiaoDong Huang
901e94ed1a fix(rockchip): add parenthesis for BITS_SHIFT macro
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
Change-Id: Ideac271469f0753c5b7aaed7bb07a792b64ae01e
2024-06-17 10:57:29 +08:00
XiaoDong Huang
d43a2e8bf4 fix(rockchip): xlat: fix compatibility between v1 and v2
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
Change-Id: I1194ef232947ba90fa374466773373762a5acdb5
2024-06-17 10:57:29 +08:00
Chris Kay
7c4e1eea61 build: unify verbosity handling
This change introduces a few helper variables for dealing with verbose
and silent build modes: `silent`, `verbose`, `q` and `s`.

The `silent` and `verbose` variables are boolean values determining
whether the build system has been configured to run silently or
verbosely respectively (i.e. with `--silent` or `V=1`).

These two modes cannot be used together - if `silent` is truthy then
`verbose` is always falsy. As such:

    make --silent V=1

... results in a silent build.

In addition to these boolean variables, we also introduce two new
variables - `s` and `q` - for use in rule recipes to conditionally
suppress the output of commands.

When building silently, `s` expands to a value which disables the
command that follows, and `q` expands to a value which supppresses
echoing of the command:

    $(s)echo 'This command is neither echoed nor executed'
    $(q)echo 'This command is executed but not echoed'

When building verbosely, `s` expands to a value which disables the
command that follows, and `q` expands to nothing:

    $(s)echo 'This command is neither echoed nor executed'
    $(q)echo 'This command is executed and echoed'

In all other cases, both `s` and `q` expand to a value which suppresses
echoing of the command that follows:

    $(s)echo 'This command is executed but not echoed'
    $(q)echo 'This command is executed but not echoed'

The `s` variable is predominantly useful for `echo` commands, where you
always want to suppress echoing of the command itself, whilst `q` is
more useful for all other commands.

Change-Id: I8d8ff6ed714d3cb401946c52955887ed7dca602b
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-06-14 15:54:48 +00:00
shengfei Xu
9fd9f1d024 feat(rockchip): add RK3566/RK3568 Socs support
RK3566/RK3568 is a Quad-core soc and Cortex-a55 inside.
This patch supports the following functions:
1. basic platform setup
2. power up/off cpus
3. suspend/resume cpus
4. suspend/resume system
5. reset system

Signed-off-by: shengfei Xu <xsf@rock-chips.com>
Change-Id: I8b98a4d07664de26bd6078f63664cbc3d9c1c68c
2024-06-07 11:59:46 +02:00
Andrey Skvortsov
e5e9ccdb0c fix(rockchip): add support for building with LTO enabled
Using the asm .incbin statement in C sources breaks gcc wrapper.
Build fails with a following errors:
  /tmp/ccRXHTU4.s: Assembler messages:
  /tmp/ccRXHTU4.s:34: Warning: dwarf line number information for .pmusram.incbin ignored
  ...
  /tmp/ccRXHTU4.s:2119: Warning: dwarf line number information for .pmusram.incbin ignored
  /tmp/ccRXHTU4.s:112497: Error: leb128 operand is an undefined symbol: .LVU5
  /tmp/ccRXHTU4.s:112498: Error: leb128 operand is an undefined symbol: .LVU6
  /tmp/ccRXHTU4.s:112507: Error: leb128 operand is an undefined symbol: .LVU9
  ...
  /tmp/ccRXHTU4.s:115407: Error: leb128 operand is an undefined symbol: .LVU668
  /tmp/ccRXHTU4.s:115408: Error: leb128 operand is an undefined symbol: .LVU710
  /tmp/ccRXHTU4.s:115409: Error: leb128 operand is an undefined symbol: .LVU713
  lto-wrapper: fatal error: aarch64-none-elf-gcc returned 1 exit status
  compilation terminated.
  aarch64-none-elf/bin/ld: error: lto-wrapper failed
  collect2: error: ld returned 1 exit status

Fix it in a similar way to what the Linux kernel does, see commit
919aa45e43a84d40c27c83f6117cfa6542cee14e (MODSIGN: Avoid using .incbin
in C source). [1]

1. https://lkml.org/lkml/2012/12/4/136

Change-Id: Iecc19729ce59e8c3b3c30fa37b1fddef95e83c96
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
2024-02-24 00:42:50 +03:00
Chris Kay
ffb7742125 build: use new toolchain variables for tools
This change migrates the values of `CC`, `CPP`, `AS` and other toolchain
variables to the new `$(toolchain)-$(tool)` variables, which were
introduced by the toolchain refactor patch. These variables should be
equivalent to the values that they're replacing.

Change-Id: I644fe4ce82ef1894bed129ddb4b6ab94fb04985d
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-02-06 11:14:52 +00:00
Chris Kay
cc277de816 build: refactor toolchain detection
This change refactors how we identify the toolchain, with the ultimate
aim of eventually cleaning up the various mechanisms that we employ to
configure default tools, identify the tools in use, and configure
toolchain flags.

To do this, we introduce three new concepts in this change:

- Toolchain identifiers,
- Tool class identifiers, and
- Tool identifiers.

Toolchain identifiers identify a configurable chain of tools targeting
one platform/machine/architecture. Today, these are:

- The host machine, which receives the `host` identifier,
- The AArch32 architecture, which receives the `aarch32` identifier, and
- The AArch64 architecture, which receivs the `aarch64` identifier.

The tools in a toolchain may come from different vendors, and are not
necessarily expected to come from one single toolchain distribution. In
most cases it is perfectly valid to mix tools from different toolchain
distributions, with some exceptions (notably, link-time optimization
generally requires the compiler and the linker to be aligned).

Tool class identifiers identify a class (or "role") of a tool. C
compilers, assemblers and linkers are all examples of tool classes.

Tool identifiers identify a specific tool recognized and supported by
the build system. Every tool that can make up a part of a toolchain must
receive a tool identifier.

These new identifiers can be used to retrieve information about the
toolchain in a more standardized fashion.

For example, logic in a Makefile that should only execute when the C
compiler is GNU GCC can now check the tool identifier for the C compiler
in the relevant toolchain:

    ifeq ($($(ARCH)-cc-id),gnu-gcc)
        ...
    endif

Change-Id: Icc23e43aaa32f4fd01d8187c5202f5012a634e7c
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-02-06 11:14:52 +00:00
Chris Kay
1685b42065 build: remove the NM variable
No part of the build system uses the `NM` variable, which is usually
used to dump symbol tables from compiled images. This change removes all
declarations of it.

Change-Id: I796ff365e6a7f97d21678f1c8cf8b59bfbb1ae9c
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-01-18 13:58:04 +00:00
Chris Kay
7e38758925 build: prefer gcc-ar over ar
The `gcc-ar` wrapper exists to make it easier to support LTO on some
versions of GCC. The two commands are compatible, accepting exactly the
same arguments, so this change moves us to `gcc-ar` to ensure that we
are configuring LTO correctly.

Change-Id: I24a4cfaad29d35b09f847299081f83ca9b41aa8a
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-01-18 13:58:03 +00:00
Chris Kay
781cb31439 build: always use the C compiler to preprocess
We're a bit inconsistent about which tool we use to preprocess source
files; in some places we use `$(CC) -E` whilst in others we use `cpp`.

This change forces all invocations of the C preprocessor to use the
first scheme, which ensures that the preprocessor behaves the same way
as the C compiler used when compiling C source files.

Change-Id: Iede2f25ff86ea8b43d7a523e32648058d5023832
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-01-18 13:58:03 +00:00
Diederik de Haas
dd2c888606 fix(rk3328): apply ERRATA_A53_1530924 erratum
Apply erratum ERRATA_A53_1530924.

Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: Ib4130fd9d4cd16b12322f44e91196607fcb6bf6b
2023-11-27 18:10:30 +01:00
Michal Simek
13ff6e9dde chore: remove MULTI_CONSOLE_API references
MULTI_CONSOLE_API have been removed long time ago by commit 5b6ebeec9c
("Remove MULTI_CONSOLE_API flag and references to it") that's why remove
references in platform.mk files and also in one rst which is not valid
anymore.

Change-Id: I45f8e7db0a14ce63de62509100d8159b7aca2657
Signed-off-by: Michal Simek <michal.simek@amd.com>
2023-09-12 15:28:36 +02:00
Juan Pablo Conde
043f38fd50 build(bl32): added check for AARCH32_SP
If AACRH32_SP is not specified, it causes the DEFAULT_LINKER_SCRIPT
variable to be empty, and then the linker takes the variable following
it as if it was the linker script, which is not one. This patch
addresses that issue by requiring the AARCH32_SP variable to be set
before continuing.

Change-Id: I21db7d5bd86b98faaa1a1cd3f985daa592556a2d
Signed-off-by: Juan Pablo Conde <juanpablo.conde@arm.com>
2023-08-24 14:22:34 -05:00
Elyes Haouas
1b491eead5 fix(tree): correct some typos
found using codespell (https://github.com/codespell-project/codespell).

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Change-Id: I1bfa797e3460adddeefa916bb68e22beddaf6373
2023-05-09 15:57:12 +01:00
Elyes Haouas
8557d491b6 fix(rockchip): use semicolon instead of comma
Use semicolon insted of comma at the end of line.

Change-Id: I0ec7a70ec659333c98d586f7bebd5d91bd6c6cc1
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-05-09 15:57:00 +01:00
Elyes Haouas
9a90d720b8 style: remove useless trailing semicolon and line continuations
found using checkpatch.pl[1]

[1]: https://review.coreboot.org/plugins/gitiles/coreboot/+/refs/heads/master/util/lint/checkpatch.pl

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Change-Id: I7957c9694300fefb85d11f7819c43af95271f14c
2023-03-09 14:59:08 +01:00
Chris Kay
da04341ed5 build: always prefix section names with .
Some of our specialized sections are not prefixed with the conventional
period. The compiler uses input section names to derive certain other
section names (e.g. `.rela.text`, `.relacpu_ops`), and these can be
difficult to select in linker scripts when there is a lack of a
delimiter.

This change introduces the period prefix to all specialized section
names.

BREAKING-CHANGE: All input and output linker section names have been
 prefixed with the period character, e.g. `cpu_ops` -> `.cpu_ops`.

Change-Id: I51c13c5266d5975fbd944ef4961328e72f82fc1c
Signed-off-by: Chris Kay <chris.kay@arm.com>
2023-02-20 18:29:33 +00:00
Quentin Schulz
621acbd055 fix(rockchip): align fdt buffer on 8 bytes
Since commit 94b2f94bd6 ("feat(libfdt): upgrade libfdt source files"),
8-byte alignment of the FDT address is enforced to follow the DT
standard.

Rockchip implementation of params_early_setup loads the FDT address as
passed by the bootloader into a buffer. This buffer is currently made of
uint8_t which means it is not 8-byte aligned and might result in
fdt_open_into failing.

Instead, let's make this buffer uint64_t to make it 8-byte aligned.

Cc: Quentin Schulz <foss+tf-a@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Change-Id: Ifcf0e0cf4000e3661d76d3c3a2fe3921f7fe44b9
2022-11-15 11:22:42 +01:00
Scott Parlane
7a5e90a89d fix(rk3399): explicitly define the sys_sleep_flag_sram type
Recent GCC versions now do array-bounds checking which fails for
sys_sleep_flag_sram because the struct is larger than the 8-bytes
size that (void *) is

This variable is only used in one place as the struct,
so it can be defined with the struct type.

Resolves:
plat/rockchip/px30/drivers/pmu/pmu.c: In function 'rockchip_soc_sys_pwr_dm_suspend':
plat/rockchip/px30/drivers/pmu/pmu.c:977:23: error: array subscript 'struct psram_data_t[0]' is partly outside array bounds of 'void[8]' [-Werror=array-bounds]
  977 |         psram_boot_cfg->pm_flag &= ~PM_WARM_BOOT_BIT;

Change-Id: Ifbe42d11d0c7875f6cb23dc0b7ffb3f3f90c55a8
Signed-off-by: Scott Parlane <scott@parlanenz.com>
2022-10-12 10:31:03 +13:00