Merge remote-tracking branch 'upstream/main' into update Change-Id: Ica4acb814c9b3d180926ef3f3c70be79d4358af6
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg new file mode 100644 index 0000000..8deda18 --- /dev/null +++ b/PREUPLOAD.cfg
@@ -0,0 +1,13 @@ +# Per-project `repo upload` hook settings. +# https://android.googlesource.com/platform/tools/repohooks + +[Options] +ignore_merged_commits = true + +[Builtin Hooks] +cpplint = false +pylint3 = false +clang_format = false + +[Hook Scripts] +yapf-diff = ${REPO_ROOT}/scripts/preupload-hooks/yapf-diff.sh --bypass
diff --git a/sdk/boards/bancha.json b/sdk/boards/bancha.json new file mode 100644 index 0000000..7716a26 --- /dev/null +++ b/sdk/boards/bancha.json
@@ -0,0 +1,105 @@ +{ + "devices": { + "clint": { + "start" : 0x2000000, + "length" : 0x10000 + }, + "plic": { + "start" : 0x48000000, + "length" : 0x400000 + }, + "uart": { + "start": 0x40000000, + "end": 0x40000100 + }, + "i2s": { + "start": 0x54100000, + "length": 0x40 + }, + "ml_top_core": { + "start": 0x5C000000, + "length": 0x40 + }, + "ml_top_dmem": { + "start": 0x5A000000, + "length": 0x400000 + }, + "gpio": { + "start": 0x40040000, + "length": 0x40 + }, + "pinmux": { + "start": 0x40460000, + "length": 0x1000 + }, + "spi_host": { + "start": 0x40300000, + "length": 0x40 + }, + "flash_ctrl": { + "start": 0x41000000, + "length": 0x200 + }, + "otp": { + "start": 0x40130000, + "length": 0x2000 + }, + "shadow" : { + "start": 0x10370000, + "end": 0x10380000 + } + }, + "instruction_memory": { + "start": 0x10000380, + "end": 0x10400000 + }, + "heap": { + "start": 0x10380000, + "end": 0x10400000 + }, + "interrupts": [ + { + "name": "I2sRxWatermarkInterrupt", + "number": 40, + "priority": 3 + }, + { + "name": "I2sTxWatermarkInterrupt", + "number": 39, + "priority": 3 + }, + { + "name": "I2sTxEmptyInterrupt", + "number": 41, + "priority": 3 + }, + { + "name": "MlTopFinishInterrupt", + "number": 34, + "priority": 3 + }, + { + "name": "MlTopFaultInterrupt", + "number": 35, + "priority": 3 + }, + { + "name": "UartRxWatermark", + "number": 2, + "priority": 3, + "edge_triggered": true + } + ], + "defines" : [ "BANCHA" ], + "driver_includes" : [ + "${sdk}/include/platform/bancha", + "${sdk}/include/platform/sencha", + "${sdk}/include/platform/generic-riscv" + ], + "timer_hz" : 2000, + "tickrate_hz" : 10, + "revoker" : "software", + "stack_high_water_mark" : true, + "simulator" : "cheriot_sim", + "simulation": true +}
diff --git a/sdk/boards/sencha.json b/sdk/boards/sencha.json new file mode 100644 index 0000000..92912ce --- /dev/null +++ b/sdk/boards/sencha.json
@@ -0,0 +1,103 @@ +{ + "devices": { + "clint": { + "start" : 0x2000000, + "length" : 0x10000 + }, + "plic": { + "start" : 0x60000000, + "length" : 0x400000 + }, + "uart": { + "start": 0x54000000, + "end": 0x54000100 + }, + "i2s": { + "start": 0x54100000, + "length": 0x40 + }, + "ml_top_core": { + "start": 0x5C000000, + "length": 0x40 + }, + "ml_top_dmem": { + "start": 0x5A000000, + "length": 0x400000 + }, + "mailbox_smc": { + "start": 0x540F1000, + "length": 0x40 + }, + "shadow" : { + "start": 0x50077000, + "end": 0x50078000 + } + }, + "instruction_memory": { + "start": 0x50000000, + "end": 0x50080000 + }, + "heap": { + "start": 0x50078000, + "end": 0x50080000 + }, + "interrupts": [ + { + "name": "I2sRxWatermarkInterrupt", + "number": 40, + "priority": 3 + }, + { + "name": "I2sTxWatermarkInterrupt", + "number": 39, + "priority": 3 + }, + { + "name": "I2sTxEmptyInterrupt", + "number": 41, + "priority": 3 + }, + { + "name": "MlTopFinishInterrupt", + "number": 34, + "priority": 3 + }, + { + "name": "MlTopFaultInterrupt", + "number": 35, + "priority": 3 + }, + { + "name": "MailboxWtInterrupt", + "number": 30, + "priority": 3 + }, + { + "name": "MailboxRtInterrupt", + "number": 31, + "priority": 3 + }, + { + "name": "MailboxEInterrupt", + "number": 32, + "priority": 3 + }, + { + "name": "UartRxWatermark", + "number": 2, + "priority": 3, + "edge_triggered": true + } + ], + "defines" : [ "SENCHA" ], + "driver_includes" : [ + "${sdk}/include/platform/sencha", + "${sdk}/include/platform/generic-riscv" + ], + "timer_hz" : 2000, + "tickrate_hz" : 10, + "revoker" : "software", + "stack_high_water_mark" : true, + "simulator" : "cheriot_sim", + "simulation": true +}
diff --git a/sdk/core/scheduler/thread.h b/sdk/core/scheduler/thread.h index e0cc5e4..4ed345b 100644 --- a/sdk/core/scheduler/thread.h +++ b/sdk/core/scheduler/thread.h
@@ -361,7 +361,7 @@ */ static bool exit() { - Debug::log("Thread exited, {} threads remaining", threadCount - 1); + Debug::log("Thread {} exited, {} threads remaining", current->threadId, threadCount - 1); current->list_remove(&priorityList[current->priority]); current->state = ThreadState::Exited; return (--threadCount) == 0;
diff --git a/sdk/include/assert.h b/sdk/include/assert.h index 5f3dd9c..4e83e5d 100644 --- a/sdk/include/assert.h +++ b/sdk/include/assert.h
@@ -12,4 +12,8 @@ # define assert(x) ((x) ? (void)0 : panic()) #endif +#ifndef static_assert +#define static_assert _Static_assert +#endif + #endif // _ASSERT_H_
diff --git a/sdk/include/platform/sencha/platform-i2s.hh b/sdk/include/platform/sencha/platform-i2s.hh new file mode 100644 index 0000000..1bc3540 --- /dev/null +++ b/sdk/include/platform/sencha/platform-i2s.hh
@@ -0,0 +1,17 @@ +#pragma once +#include <compartment-macros.h> +#include <interrupt.h> +#include <riscvreg.h> + +DECLARE_AND_DEFINE_INTERRUPT_CAPABILITY(i2sRxWatermarkInterruptCapability, + InterruptName::I2sRxWatermarkInterrupt, + true, + true) +DECLARE_AND_DEFINE_INTERRUPT_CAPABILITY(i2sTxWatermarkInterruptCapability, + InterruptName::I2sTxWatermarkInterrupt, + true, + true) +DECLARE_AND_DEFINE_INTERRUPT_CAPABILITY(i2sTxEmptyInterruptCapability, + InterruptName::I2sTxEmptyInterrupt, + true, + true)
diff --git a/sdk/include/platform/sencha/platform-mailbox.hh b/sdk/include/platform/sencha/platform-mailbox.hh new file mode 100644 index 0000000..fb172e5 --- /dev/null +++ b/sdk/include/platform/sencha/platform-mailbox.hh
@@ -0,0 +1,9 @@ +#pragma once +#include <compartment-macros.h> +#include <interrupt.h> +#include <riscvreg.h> + +DECLARE_AND_DEFINE_INTERRUPT_CAPABILITY(mailboxRtInterruptCapability, + InterruptName::MailboxRtInterrupt, + true, + true)
diff --git a/sdk/include/platform/sencha/platform-ml_top.hh b/sdk/include/platform/sencha/platform-ml_top.hh new file mode 100644 index 0000000..cb7af3b --- /dev/null +++ b/sdk/include/platform/sencha/platform-ml_top.hh
@@ -0,0 +1,13 @@ +#pragma once +#include <compartment-macros.h> +#include <interrupt.h> +#include <riscvreg.h> + +DECLARE_AND_DEFINE_INTERRUPT_CAPABILITY(mlTopFinishInterruptCapability, + InterruptName::MlTopFinishInterrupt, + true, + true) +DECLARE_AND_DEFINE_INTERRUPT_CAPABILITY(mlTopFaultInterruptCapability, + InterruptName::MlTopFaultInterrupt, + true, + true)
diff --git a/sdk/include/platform/sencha/platform-uart.hh b/sdk/include/platform/sencha/platform-uart.hh new file mode 120000 index 0000000..1f6d864 --- /dev/null +++ b/sdk/include/platform/sencha/platform-uart.hh
@@ -0,0 +1 @@ +../sunburst/platform-uart.hh \ No newline at end of file