aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2020-08-20 11:17:41 +0200
committerSandrine Bailleux <sandrine.bailleux@arm.com>2020-08-20 15:29:01 +0000
commit06ffa16694b315380c9b2ebafe06d83873f2a78d (patch)
tree2f359d7bc620edcd8fc492165a521baf7bd42894 /docs
parent9061c0c9ab70bea29a56f1ea73f8f0f8859f0bab (diff)
downloadtrusted-firmware-a-06ffa16694b315380c9b2ebafe06d83873f2a78d.tar.gz
doc: Recommend using C rather than assembly language
Add a section for that in the coding guidelines. Change-Id: Ie6819c4df5889a861460eb96acf2bc9c0cfb494e Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/process/coding-guidelines.rst19
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/process/coding-guidelines.rst b/docs/process/coding-guidelines.rst
index 97086047d0..a8a84549af 100644
--- a/docs/process/coding-guidelines.rst
+++ b/docs/process/coding-guidelines.rst
@@ -441,6 +441,25 @@ unsigned integer on all systems, cast it to ``unsigned int``.
These guidelines should be updated if additional types are needed.
+Favor C language over assembly language
+---------------------------------------
+
+Generally, prefer code written in C over assembly. Assembly code is less
+portable, harder to understand, maintain and audit security wise. Also, static
+analysis tools generally don't analyze assembly code.
+
+There are, however, legitimate uses of assembly language. These include:
+
+ - Early boot code executed before the C runtime environment is setup.
+
+ - Exception handling code.
+
+ - Low-level code where the exact sequence of instructions executed on the CPU
+ matters, such as CPU reset sequences.
+
+ - Low-level code where specific system-level instructions must be used, such
+ as cache maintenance operations.
+
--------------
*Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.*