summaryrefslogtreecommitdiff
path: root/lib/libc
AgeCommit message (Collapse)Author
2019-12-13Add NXP's i.MX8 SoCs system controller console supportAnson Huang
NXP's i.MX8 SoCs with system controller inside support outputting debug message to system controller's console via calling SCFW API, since TF-A shares debug console with Linux kernel which will have confliction if Linux kernel and TF-A's console are both enabled, this patch adds support for switching TF-A debug console to system controller to easy TF-A debug. Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-09-11libc: fix sparse warning for __assert()Masahiro Yamada
Sparse warns this: lib/libc/assert.c:29:6: error: symbol '__assert' redeclared with different type (originally declared at include/lib/libc/assert.h:36) - different modifiers Add __dead2 to match the header declaration and C definition. I also changed '__dead2 void' to 'void __dead2' for the consistency with other parts. Change-Id: Iefa4f0e787c24fa7e7e499d2e7baf54d4deb49ef Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-06-20libc: fix memchr implementationAmbroise Vincent
The previous implementation could behave incorrectly because of the sign extension of the char when compared to the int. Change-Id: I397838b0ec87a6f1af6972d022a8c19a5184b447 Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
2019-04-01Remove several warnings reported with W=1Ambroise Vincent
Improved support for W=1 compilation flag by solving missing-prototypes and old-style-definition warnings. The libraries are compiling with warnings (which turn into errors with the Werror flag). Outside of libraries, some warnings cannot be fixed without heavy structural changes. Change-Id: I1668cf99123ac4195c2a6a1d48945f7a64c67f16 Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
2019-02-08libc: Move setjmp to libc folderAntonio Nino Diaz
Now that setjmp() and longjmp() are compliant with the standard they can be moved with the other libc files. Change-Id: Iea3b91c34eb353ace5e171e72f331602d57774d5 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2019-01-04Sanitise includes across codebaseAntonio Nino Diaz
Enforce full include path for includes. Deprecate old paths. The following folders inside include/lib have been left unchanged: - include/lib/cpus/${ARCH} - include/lib/el3_runtime/${ARCH} The reason for this change is that having a global namespace for includes isn't a good idea. It defeats one of the advantages of having folders and it introduces problems that are sometimes subtle (because you may not know the header you are actually including if there are two of them). For example, this patch had to be created because two headers were called the same way: e0ea0928d5b7 ("Fix gpio includes of mt8173 platform to avoid collision."). More recently, this patch has had similar problems: 46f9b2c3a282 ("drivers: add tzc380 support"). This problem was introduced in commit 4ecca33988b9 ("Move include and source files to logical locations"). At that time, there weren't too many headers so it wasn't a real issue. However, time has shown that this creates problems. Platforms that want to preserve the way they include headers may add the removed paths to PLAT_INCLUDES, but this is discouraged. Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8f Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-11-02libc: Adapt strlcpy to this codebaseAntonio Nino Diaz
Change-Id: I2f5f64aaf90caae936510e1179392a8835f493e0 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-11-02libc: Import strlcpy from FreeBSDAntonio Nino Diaz
From commit aafd1cf4235d78ce85b76d7da63e9589039344b3: - lib/libc/strlcpy.c Change-Id: Iaa7028fcc26706bdd6ee3f1e4bd55dd5873a30c6 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-10-23libc: Integrate strrchr in libcAntonio Nino Diaz
Change-Id: I3ddc07cb02d73cd7614af7a5b21827aae155f9a0 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-10-23libc: Import strrchr from FreeBSDAntonio Nino Diaz
Imported from lib/libc/string/strrchr.c from commit: 59fd2fb98e4cc7e9bfc89598e28e21d405fd470c Change-Id: I898206c6f0372d4d211c149ec0fb9522d0a5b01c Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-09-21Ensure the flow through switch statements is clearDaniel Boulby
Ensure case clauses: * Terminate with an unconditional break, return or goto statement. * Use conditional break, return or goto statements as long as the end of the case clause is unreachable; such case clauses must terminate with assert(0) /* Unreachable */ or an unconditional __dead2 function call * Only fallthough when doing otherwise would result in less readable/maintainable code; such case clauses must terminate with a /* Fallthrough */ comment to make it clear this is the case and indicate that a fallthrough is intended. This reduces the chance of bugs appearing due to unintended flow through a switch statement Change-Id: I70fc2d1f4fd679042397dec12fd1982976646168 Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
2018-08-30libc: Fix some MISRA defectsAntonio Nino Diaz
No functional changes. Change-Id: I907aa47565af2a6c435a5560041fd2b59e65c25c Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-30backtrace: Print backtrace in assert() and panic()Antonio Nino Diaz
When any of these functions is called the backtrace will be printed to the console. Change-Id: Id60842df824b320c485a9323ed6b80600f4ebe35 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-22libc: Use printf and snprintf across codebaseAntonio Nino Diaz
tf_printf and tf_snprintf are now called printf and snprintf, so the code needs to be updated. Change-Id: Iffeee97afcd6328c4c2d30830d4923b964682d71 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-22libc: Move tf_printf and tf_snprintf to libcAntonio Nino Diaz
Change their names to printf and snprintf. They are much smaller than the previous versions we had, which makes them better suited for the Trusted Firmware. Change-Id: Ia872af91b7b967c47fce012eccecede7873a3daf Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-22libc: Fix all includes in codebaseAntonio Nino Diaz
The codebase was using non-standard headers. It is needed to replace them by the correct ones so that we can use the new libc headers. Change-Id: I530f71d9510cb036e69fe79823c8230afe890b9d Acked-by: Sumit Garg <sumit.garg@linaro.org> Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-22libc: Add AArch32 and AArch64 headersAntonio Nino Diaz
Change-Id: I4f58bb4660078c9bc76d2826c90b2fa711719a3e Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-22libc: Cleanup FreeBSD filesAntonio Nino Diaz
Remove code specific to FreeBSD so that they can be used in this repository. Change-Id: I5c11eb5b3c05a7fb91aed08371a1f7a0e6122a94 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-22libc: Import files from FreeBSDAntonio Nino Diaz
From commit aafd1cf4235d78ce85b76d7da63e9589039344b3: - sys/sys/endian.h - sys/arm/include/endian.h - sys/arm64/include/endian.h - sys/sys/errno.h - lib/libc/strchr.c - lib/libc/strcmp.c - lib/libc/strncmp.c - lib/libc/strnlen.c strcasecmp() hasn't been imported. Change-Id: I8a0787aec9ba8960a008fb5c66f7a73c84919b93 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-22libc: Introduce cdefs.h, assert.h and strlen.cAntonio Nino Diaz
Change-Id: I76091d52571f1950111c4b1670d5fc3883607715 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-22libc: Cleanup remaining filesAntonio Nino Diaz
The existing files had some style problems that this patch fixes. Change-Id: I794e0d96e52f8da0ffa0d70a41f36c4432b4e563 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-22libc: Remove printf-like functionsAntonio Nino Diaz
They are too big for the Trusted Firmware, and it can be confusing to have two versions of the same functions with different names. tf_printf and tf_snprintf will replace them in the next patch. Change-Id: I978414ac169cc3156e249549ef101a70eb31a295 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-22libc: Remove sscanf() and timingsafe_bcmp()Antonio Nino Diaz
sscanf() is unused and it doesn't work, so it doesn't make sense to keep it. timingsafe_bcmp() isn't used anywhere. Change-Id: Ib5d28ff21d0f3ccc36c5c0fb5474b3384105cf80 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-22libc: Remove non-Arm filesAntonio Nino Diaz
Remove all files that don't have only Arm copyright. This is the first step to cleanup the C library in this repository. They will be re-added in the following patches. Change-Id: I72c40a1620d1df3228fc397ec695d569a20245fd Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-03Add atexit function to libcRoberto Vargas
We had exit but we didn't have atexit, and we were calling panic and tf_printf from exit, which generated a dependency from exit to them. Having atexit allows to set a different function pointer in every image. Change-Id: I95b9556d680d96249ed3b14da159b6f417da7661 Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-08-03Create a library file for libcRoberto Vargas
TF Makefile was linking all the objects files generated for the c library instead of creating a static library that could be used in the linking stage. Change-Id: I721daea097e9b13cbb42c9f8eaa2af8fea0799cf Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>