aboutsummaryrefslogtreecommitdiff
path: root/projects/cros-ec
diff options
context:
space:
mode:
Diffstat (limited to 'projects/cros-ec')
-rw-r--r--projects/cros-ec/configs/nyan/revision2
-rw-r--r--projects/cros-ec/configs/veyron/revision2
-rw-r--r--projects/cros-ec/patches/veyron/0005-Don-t-include-missing-and-unnecessary-math-header.patch29
-rw-r--r--projects/cros-ec/patches/veyron/0005-cortex-m0-Use-assembly-exception-handlers-for-task-s.patch (renamed from projects/cros-ec/patches/veyron/0006-cortex-m0-Use-assembly-exception-handlers-for-task-s.patch)180
-rw-r--r--projects/cros-ec/patches/veyron/0006-Remove-duplicate-consts-declaration-specifiers.patch63
-rw-r--r--projects/cros-ec/patches/veyron/0007-Remove-unused-SHA256_digestinfo-declaration.patch31
6 files changed, 196 insertions, 111 deletions
diff --git a/projects/cros-ec/configs/nyan/revision b/projects/cros-ec/configs/nyan/revision
index 6ce6b84b..c5b2d348 100644
--- a/projects/cros-ec/configs/nyan/revision
+++ b/projects/cros-ec/configs/nyan/revision
@@ -1 +1 @@
-origin/release-R65-10323.B
+origin/firmware-nyan-5771.B
diff --git a/projects/cros-ec/configs/veyron/revision b/projects/cros-ec/configs/veyron/revision
index 6ce6b84b..6c728396 100644
--- a/projects/cros-ec/configs/veyron/revision
+++ b/projects/cros-ec/configs/veyron/revision
@@ -1 +1 @@
-origin/release-R65-10323.B
+origin/firmware-veyron-6588.B
diff --git a/projects/cros-ec/patches/veyron/0005-Don-t-include-missing-and-unnecessary-math-header.patch b/projects/cros-ec/patches/veyron/0005-Don-t-include-missing-and-unnecessary-math-header.patch
deleted file mode 100644
index 0a099213..00000000
--- a/projects/cros-ec/patches/veyron/0005-Don-t-include-missing-and-unnecessary-math-header.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 913b2f1265bd7f3ebe6cf4cba92c20c5a423a6c3 Mon Sep 17 00:00:00 2001
-From: Paul Kocialkowski <contact@paulk.fr>
-Date: Tue, 2 Aug 2016 12:05:55 +0200
-Subject: [PATCH 5/6] Don't include missing and unnecessary math header
-
-This removes the inclusion of an unnecessary math header that is neither
-found nor necessary for non-cortex-m ECs.
-
-Change-Id: I56a04178dadedb76f841504fa645e2d43900d25f
-Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
----
- common/math_util.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/common/math_util.c b/common/math_util.c
-index 120d13d..34a267d 100644
---- a/common/math_util.c
-+++ b/common/math_util.c
-@@ -6,7 +6,6 @@
- /* Common math functions. */
-
- #include "common.h"
--#include "math.h"
- #include "math_util.h"
- #include "util.h"
-
---
-2.9.0
-
diff --git a/projects/cros-ec/patches/veyron/0006-cortex-m0-Use-assembly-exception-handlers-for-task-s.patch b/projects/cros-ec/patches/veyron/0005-cortex-m0-Use-assembly-exception-handlers-for-task-s.patch
index f0175825..b70e471e 100644
--- a/projects/cros-ec/patches/veyron/0006-cortex-m0-Use-assembly-exception-handlers-for-task-s.patch
+++ b/projects/cros-ec/patches/veyron/0005-cortex-m0-Use-assembly-exception-handlers-for-task-s.patch
@@ -1,8 +1,7 @@
-From 9dd7ae82d3f3fa9dae31a442365e233a0b44cce3 Mon Sep 17 00:00:00 2001
+From 27501308493bf2adadfc3b133fd1d6f4b4feec12 Mon Sep 17 00:00:00 2001
From: Paul Kocialkowski <contact@paulk.fr>
Date: Sat, 23 Jul 2016 14:17:32 +0200
-Subject: [PATCH 6/6] cortex-m0: Use assembly exception handlers for task
- switching
+Subject: [PATCH] cortex-m0: Use assembly exception handlers for task switching
The way Cortex processors handle exceptions allows writing exception
routines directly in C, as return from exception is handled by providing
@@ -38,15 +37,12 @@ TEST=Build and run speedy EC with a recent GCC version
Change-Id: Ib068bc12ce2204aee3e0f563efcb94f15aa87013
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
- core/cortex-m0/switch.S | 81 ++++++++++++++++++++++++++++++++++---------------
- core/cortex-m0/task.c | 27 +----------------
- 2 files changed, 58 insertions(+), 50 deletions(-)
diff --git a/core/cortex-m0/switch.S b/core/cortex-m0/switch.S
index 95ea29e..d4b47cd 100644
--- a/core/cortex-m0/switch.S
+++ b/core/cortex-m0/switch.S
-@@ -7,12 +7,52 @@
+@@ -7,55 +7,14 @@
#include "config.h"
@@ -58,29 +54,56 @@ index 95ea29e..d4b47cd 100644
.code 16
/**
-+ * Start the task scheduling. r0 is a pointer to task_stack_ready, which is
-+ * set to 1 after the task stack is set up.
-+ */
-+.global __task_start
-+.thumb_func
-+__task_start:
-+ ldr r2,=scratchpad @ area used as dummy thread stack for the first switch
-+ movs r3, #2 @ use : priv. mode / thread stack / no floating point
-+ adds r2, #17*4 @ put the pointer at the top of the stack
-+ movs r1, #0 @ __Schedule parameter : re-schedule nothing
-+ msr psp, r2 @ setup a thread stack up to the first context switch
-+ movs r2, #1
-+ isb @ ensure the write is done
-+ msr control, r3
-+ movs r3, r0
-+ movs r0, #0 @ __Schedule parameter : de-schedule nothing
-+ isb @ ensure the write is done
-+ str r2, [r3] @ Task scheduling is now active
-+ bl __schedule @ execute the task with the highest priority
-+ /* we should never return here */
-+ movs r0, #1 @ set to EC_ERROR_UNKNOWN
-+ bx lr
-+
+- * Task context switching
+- *
+- * Change the task scheduled after returning from the exception.
+- *
+- * Save the registers of the current task below the exception context on
+- * its task, then restore the live registers of the next task and set the
+- * process stack pointer to the new stack.
+- *
+- * r0: pointer to the task to switch from
+- * r1: pointer to the task to switch to
+- *
+- * must be called from interrupt context
+- *
+- * the structure of the saved context on the stack is :
+- * r8, r9, r10, r11, r4, r5, r6, r7, r0, r1, r2, r3, r12, lr, pc, psr
+- * additional registers <|> exception frame
+- */
+-.global __switchto
+-.thumb_func
+-__switchto:
+- mrs r2, psp @ get the task stack where the context has been saved
+- mov r3, sp
+- mov sp, r2
+- push {r4-r7} @ save additional r4-r7 in the task stack
+- mov r4, r8
+- mov r5, r9
+- mov r6, r10
+- mov r7, r11
+- push {r4-r7} @ save additional r8-r11 in the task stack
+- mov r2, sp @ prepare to save former task stack pointer
+- mov sp, r3 @ restore system stack pointer
+- str r2, [r0] @ save the task stack pointer in its context
+- ldr r2, [r1] @ get the new scheduled task stack pointer
+- ldmia r2!, {r4-r7} @ restore r8-r11 for the next task context
+- mov r8, r4
+- mov r9, r5
+- mov r10, r6
+- mov r11, r7
+- ldmia r2!, {r4-r7} @ restore r4-r7 for the next task context
+- msr psp, r2 @ set the process stack pointer to exception context
+- bx lr @ return from exception
+-
+-/**
+ * Start the task scheduling. r0 is a pointer to task_stack_ready, which is
+ * set to 1 after the task stack is set up.
+ */
+@@ -79,3 +38,77 @@
+ movs r0, #1 @ set to EC_ERROR_UNKNOWN
+ bx lr
+
+/**
+ * SVC exception handler
+ */
@@ -96,53 +119,53 @@ index 95ea29e..d4b47cd 100644
+ /* continue to __switchto to switch to the new task */
+
+/**
- * Task context switching
- *
- * Change the task scheduled after returning from the exception.
-@@ -30,8 +70,6 @@
- * r8, r9, r10, r11, r4, r5, r6, r7, r0, r1, r2, r3, r12, lr, pc, psr
- * additional registers <|> exception frame
- */
--.global __switchto
--.thumb_func
- __switchto:
- mrs r2, psp @ get the task stack where the context has been saved
- mov r3, sp
-@@ -53,29 +91,24 @@ __switchto:
- mov r11, r7
- ldmia r2!, {r4-r7} @ restore r4-r7 for the next task context
- msr psp, r2 @ set the process stack pointer to exception context
-- bx lr @ return from exception
++ * Task context switching
++ *
++ * Change the task scheduled after returning from the exception.
++ *
++ * Save the registers of the current task below the exception context on
++ * its task, then restore the live registers of the next task and set the
++ * process stack pointer to the new stack.
++ *
++ * r0: pointer to the task to switch from
++ * r1: pointer to the task to switch to
++ *
++ * must be called from interrupt context
++ *
++ * the structure of the saved context on the stack is :
++ * r8, r9, r10, r11, r4, r5, r6, r7, r0, r1, r2, r3, r12, lr, pc, psr
++ * additional registers <|> exception frame
++ */
++__switchto:
++ mrs r2, psp @ get the task stack where the context has been saved
++ mov r3, sp
++ mov sp, r2
++ push {r4-r7} @ save additional r4-r7 in the task stack
++ mov r4, r8
++ mov r5, r9
++ mov r6, r10
++ mov r7, r11
++ push {r4-r7} @ save additional r8-r11 in the task stack
++ mov r2, sp @ prepare to save former task stack pointer
++ mov sp, r3 @ restore system stack pointer
++ str r2, [r0] @ save the task stack pointer in its context
++ ldr r2, [r1] @ get the new scheduled task stack pointer
++ ldmia r2!, {r4-r7} @ restore r8-r11 for the next task context
++ mov r8, r4
++ mov r9, r5
++ mov r10, r6
++ mov r11, r7
++ ldmia r2!, {r4-r7} @ restore r4-r7 for the next task context
++ msr psp, r2 @ set the process stack pointer to exception context
+
+svc_handler_return:
+ pop {pc} @ return from exception or return to caller
-
- /**
-- * Start the task scheduling. r0 is a pointer to task_stack_ready, which is
-- * set to 1 after the task stack is set up.
++
++/**
+ * PendSVC exception handler
- */
--.global __task_start
++ */
+.global pendsv_handler
- .thumb_func
--__task_start:
-- ldr r2,=scratchpad @ area used as dummy thread stack for the first switch
-- movs r3, #2 @ use : priv. mode / thread stack / no floating point
-- adds r2, #17*4 @ put the pointer at the top of the stack
-- movs r1, #0 @ __Schedule parameter : re-schedule nothing
-- msr psp, r2 @ setup a thread stack up to the first context switch
-- movs r2, #1
-- isb @ ensure the write is done
-- msr control, r3
-- movs r3, r0
-- movs r0, #0 @ __Schedule parameter : de-schedule nothing
-- isb @ ensure the write is done
-- str r2, [r3] @ Task scheduling is now active
-- bl __schedule @ execute the task with the highest priority
-- /* we should never return here */
-- movs r0, #1 @ set to EC_ERROR_UNKNOWN
-- bx lr
--
++.thumb_func
+pendsv_handler:
+ push {lr} @ save link register
+ ldr r0, =#CPU_SCB_ICSR @ load CPU_SCB_ICSR's address
@@ -156,10 +179,10 @@ index 95ea29e..d4b47cd 100644
+ cpsie i @ leave priority 0
+ pop {pc} @ return from exception
diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c
-index e51621b..f96ccf8 100644
+index 5d219a5..0261261 100644
--- a/core/cortex-m0/task.c
+++ b/core/cortex-m0/task.c
-@@ -57,7 +57,6 @@ static uint32_t task_switches; /* Number of times active task changed */
+@@ -59,7 +59,6 @@
static uint32_t irq_dist[CONFIG_IRQ_COUNT]; /* Distribution of IRQ calls */
#endif
@@ -167,7 +190,7 @@ index e51621b..f96ccf8 100644
extern int __task_start(int *task_stack_ready);
#ifndef CONFIG_LOW_POWER_IDLE
-@@ -120,7 +119,7 @@ uint8_t task_stacks[0
+@@ -124,7 +123,7 @@
/* Reserve space to discard context on first context switch. */
uint32_t scratchpad[17];
@@ -176,7 +199,7 @@ index e51621b..f96ccf8 100644
/*
* Bitmap of all tasks ready to be run.
-@@ -242,18 +241,6 @@ task_ *__svc_handler(int desched, task_id_t resched)
+@@ -254,18 +253,6 @@
return current;
}
@@ -195,7 +218,7 @@ index e51621b..f96ccf8 100644
void __schedule(int desched, int resched)
{
register int p0 asm("r0") = desched;
-@@ -262,18 +249,6 @@ void __schedule(int desched, int resched)
+@@ -274,18 +261,6 @@
asm("svc 0" : : "r"(p0), "r"(p1));
}
@@ -214,6 +237,3 @@ index e51621b..f96ccf8 100644
#ifdef CONFIG_TASK_PROFILING
void task_start_irq_handler(void *excep_return)
{
---
-2.9.0
-
diff --git a/projects/cros-ec/patches/veyron/0006-Remove-duplicate-consts-declaration-specifiers.patch b/projects/cros-ec/patches/veyron/0006-Remove-duplicate-consts-declaration-specifiers.patch
new file mode 100644
index 00000000..f04e2f27
--- /dev/null
+++ b/projects/cros-ec/patches/veyron/0006-Remove-duplicate-consts-declaration-specifiers.patch
@@ -0,0 +1,63 @@
+From 48acbee142ed1712ecdd4e5338f2a2d46bfbb1f3 Mon Sep 17 00:00:00 2001
+From: Andrew Robbins <contact@andrewrobbins.info>
+Date: Thu, 15 Nov 2018 18:43:07 -0500
+Subject: [PATCH] Remove duplicate consts declaration specifiers
+
+---
+ util/comm-dev.c | 2 +-
+ util/ectool.c | 2 +-
+ util/lbcc.c | 6 +++---
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/util/comm-dev.c b/util/comm-dev.c
+index cdbbbdf..0fb4027 100644
+--- a/util/comm-dev.c
++++ b/util/comm-dev.c
+@@ -23,7 +23,7 @@ static int fd = -1;
+ #define ARRAY_SIZE(t) (sizeof(t) / sizeof(t[0]))
+ #endif
+
+-static const char const *meanings[] = {
++static const char *meanings[] = {
+ "SUCCESS",
+ "INVALID_COMMAND",
+ "ERROR",
+diff --git a/util/ectool.c b/util/ectool.c
+index 9ba8de9..74e6366 100644
+--- a/util/ectool.c
++++ b/util/ectool.c
+@@ -5199,7 +5199,7 @@ static int cmd_tmp006cal_v1(int idx, int argc, char *argv[])
+ int i, rv, cmdsize;
+
+ /* Algorithm 1 parameter names */
+- static const char const *alg1_pname[] = {
++ static const char *alg1_pname[] = {
+ "s0", "a1", "a2", "b0", "b1", "b2", "c2",
+ "d0", "d1", "ds", "e0", "e1",
+ };
+diff --git a/util/lbcc.c b/util/lbcc.c
+index b34b21e..eb8a7e1 100644
+--- a/util/lbcc.c
++++ b/util/lbcc.c
+@@ -81,15 +81,15 @@ static const int num_operands[] = {
+
+ #define OP(NAME, BYTES, MNEMONIC) MNEMONIC,
+ #include "lightbar_opcode_list.h"
+-static const char const *opcode_sym[] = {
++static const char *opcode_sym[] = {
+ LIGHTBAR_OPCODE_TABLE
+ };
+ #undef OP
+
+-static const char const *control_sym[] = {
++static const char *control_sym[] = {
+ "beg", "end", "phase", "<invalid>"
+ };
+-static const char const *color_sym[] = {
++static const char *color_sym[] = {
+ "r", "g", "b", "<invalid>"
+ };
+
+--
+2.7.4
+
diff --git a/projects/cros-ec/patches/veyron/0007-Remove-unused-SHA256_digestinfo-declaration.patch b/projects/cros-ec/patches/veyron/0007-Remove-unused-SHA256_digestinfo-declaration.patch
new file mode 100644
index 00000000..4f811727
--- /dev/null
+++ b/projects/cros-ec/patches/veyron/0007-Remove-unused-SHA256_digestinfo-declaration.patch
@@ -0,0 +1,31 @@
+From c4b1a9b5547321126658be2b418edc5b86010e3a Mon Sep 17 00:00:00 2001
+From: Andrew Robbins <contact@andrewrobbins.info>
+Date: Thu, 15 Nov 2018 18:54:57 -0500
+Subject: [PATCH] Remove unused SHA256_digestinfo declaration
+
+---
+ common/sha256.c | 8 --------
+ 1 file changed, 8 deletions(-)
+
+diff --git a/common/sha256.c b/common/sha256.c
+index e8f9f18..7e74a7f 100644
+--- a/common/sha256.c
++++ b/common/sha256.c
+@@ -104,14 +104,6 @@ static const uint32_t sha256_k[64] = {
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
+ 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2};
+
+-#define SHA256_DIGESTINFO_LEN 19
+-
+-static const uint8_t SHA256_digestinfo[] = {
+- 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86,
+- 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05,
+- 0x00, 0x04, 0x20
+-};
+-
+ void SHA256_init(struct sha256_ctx *ctx)
+ {
+ int i;
+--
+2.7.4
+