fw: Harmonize comment style

This commit is contained in:
Michael Cardell Widerkrantz 2025-04-29 17:49:44 +02:00
parent f373ad3f68
commit 4f4de4a07d
No known key found for this signature in database
GPG key ID: D3DB3DDF57E704E5
19 changed files with 150 additions and 158 deletions

View file

@ -1,7 +1,5 @@
/* // Copyright (C) 2022, 2023 - Tillitis AB
* Copyright (C) 2022, 2023 - Tillitis AB // SPDX-License-Identifier: GPL-2.0-only
* SPDX-License-Identifier: GPL-2.0-only
*/
#include <stdint.h> #include <stdint.h>
#include <tkey/assert.h> #include <tkey/assert.h>

View file

@ -1,7 +1,5 @@
/* // Copyright (C) 2022, 2023 - Tillitis AB
* Copyright (C) 2022, 2023 - Tillitis AB // SPDX-License-Identifier: GPL-2.0-only
* SPDX-License-Identifier: GPL-2.0-only
*/
#include <stdint.h> #include <stdint.h>
#include <tkey/assert.h> #include <tkey/assert.h>

View file

@ -1,7 +1,5 @@
/* // Copyright (C) 2022, 2023 - Tillitis AB
* Copyright (C) 2022, 2023 - Tillitis AB // SPDX-License-Identifier: GPL-2.0-only
* SPDX-License-Identifier: GPL-2.0-only
*/
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>

View file

@ -1,7 +1,5 @@
/* // Copyright (C) 2022, 2023 - Tillitis AB
* Copyright (C) 2022, 2023 - Tillitis AB // SPDX-License-Identifier: GPL-2.0-only
* SPDX-License-Identifier: GPL-2.0-only
*/
.section ".text.init" .section ".text.init"
.globl _start .globl _start
@ -38,7 +36,7 @@ _start:
li x30,0 li x30,0
li x31,0 li x31,0
/* Clear all RAM */ // Clear all RAM
li a0, 0x40000000 // TK1_RAM_BASE li a0, 0x40000000 // TK1_RAM_BASE
li a1, 0x40020000 // TK1_RAM_BASE + TK1_RAM_SIZE li a1, 0x40020000 // TK1_RAM_BASE + TK1_RAM_SIZE
clear: clear:
@ -46,9 +44,9 @@ clear:
addi a0, a0, 4 addi a0, a0, 4
blt a0, a1, clear blt a0, a1, clear
/* // NOTE WELL
* For testfw we init stack at top of RAM // For testfw we init stack at top of RAM
*/ //
li sp, 0x40020000 // TK1_RAM_BASE + TK1_RAM_SIZE li sp, 0x40020000 // TK1_RAM_BASE + TK1_RAM_SIZE
call main call main

View file

@ -1,3 +1,6 @@
// Copyright (C) 2025 - Tillitis AB
// SPDX-License-Identifier: GPL-2.0-only
#ifndef BLINK_APP_H #ifndef BLINK_APP_H
#define BLINK_APP_H #define BLINK_APP_H

View file

@ -1,3 +1,6 @@
// Copyright (C) 2025 - Tillitis AB
// SPDX-License-Identifier: GPL-2.0-only
#include <blake2s/blake2s.h> #include <blake2s/blake2s.h>
#include <monocypher/monocypher-ed25519.h> #include <monocypher/monocypher-ed25519.h>
#include <stdint.h> #include <stdint.h>

View file

@ -14,8 +14,8 @@
static volatile uint32_t *cdi = (volatile uint32_t *)TK1_MMIO_TK1_CDI_FIRST; static volatile uint32_t *cdi = (volatile uint32_t *)TK1_MMIO_TK1_CDI_FIRST;
/* Calculates the authentication digest based on a supplied nonce and the CDI. // Calculates the authentication digest based on a supplied nonce and
* Requires that the CDI is already calculated and stored */ // the CDI. Requires that the CDI is already calculated and stored
static void calculate_auth_digest(uint8_t *nonce, uint8_t *auth_digest) static void calculate_auth_digest(uint8_t *nonce, uint8_t *auth_digest)
{ {
assert(nonce != NULL); assert(nonce != NULL);
@ -31,7 +31,7 @@ static void calculate_auth_digest(uint8_t *nonce, uint8_t *auth_digest)
blake2s_final(&ctx, auth_digest); blake2s_final(&ctx, auth_digest);
} }
/* Generates a 16 byte nonce */ // Generates a 16 byte nonce
static void generate_nonce(uint32_t *nonce) static void generate_nonce(uint32_t *nonce)
{ {
assert(nonce != NULL); assert(nonce != NULL);
@ -42,8 +42,8 @@ static void generate_nonce(uint32_t *nonce)
return; return;
} }
/* Returns the authentication digest and random nonce. Requires that the CDI is // Returns the authentication digest and random nonce. Requires that
* already calculated and stored */ // the CDI is already calculated and stored
void auth_app_create(struct auth_metadata *auth_table) void auth_app_create(struct auth_metadata *auth_table)
{ {
assert(auth_table != NULL); assert(auth_table != NULL);

View file

@ -1,7 +1,5 @@
/* // Copyright (C) 2022, 2023 - Tillitis AB
* Copyright (C) 2022, 2023 - Tillitis AB // SPDX-License-Identifier: GPL-2.0-only
* SPDX-License-Identifier: GPL-2.0-only
*/
#include <blake2s/blake2s.h> #include <blake2s/blake2s.h>
#include <stdbool.h> #include <stdbool.h>
@ -607,7 +605,7 @@ int main(void)
} }
/*@ -compdestroy @*/ /*@ -compdestroy @*/
/* We don't care about memory leaks here. */ // We don't care about memory leaks here.
return (int)0xcafebabe; return (int)0xcafebabe;
} }

View file

@ -31,7 +31,7 @@ int mgmt_app_init(uint8_t app_digest[32])
return 0; return 0;
} }
/* Authenticate an management app */ // Authenticate an management app
bool mgmt_app_authenticate(void) bool mgmt_app_authenticate(void)
{ {
return memeq(current_app_digest, allowed_app_digest, 32) != 0; return memeq(current_app_digest, allowed_app_digest, 32) != 0;

View file

@ -6,25 +6,25 @@
#include <stdint.h> #include <stdint.h>
/* ---- Flash ---- ---- */ // ---- Flash ---- ----
/* name size start addr */ // name size start addr
/* ---- ---- ---- */ // ---- ---- ----
/* bitstream 128KiB 0x00 */ // bitstream 128KiB 0x00
/* ---- ---- ---- */ // ---- ---- ----
/* Partition 64KiB 0x20000 */ // Partition 64KiB 0x20000
/* ---- ---- ---- */ // ---- ---- ----
/* Pre load 1 128KiB 0x30000 */ // Pre load 1 128KiB 0x30000
/* Pre load 2 128KiB 0x50000 */ // Pre load 2 128KiB 0x50000
/* ---- ---- ---- */ // ---- ---- ----
/* storage 1 128KiB 0x70000 */ // storage 1 128KiB 0x70000
/* storage 2 128KiB 0x90000 */ // storage 2 128KiB 0x90000
/* storage 3 128KiB 0xB0000 */ // storage 3 128KiB 0xB0000
/* storage 4 128KiB 0xD0000 */ // storage 4 128KiB 0xD0000
/* ---- ---- ---- */ // ---- ---- ----
/* Partition2 64KiB 0xf0000 */ // Partition2 64KiB 0xf0000
/* To simplify all blocks are aligned with the 64KiB blocks on the W25Q80DL // To simplify all blocks are aligned with the 64KiB blocks on the
* flash. */ // W25Q80DL flash.
#define PART_TABLE_VERSION 1 #define PART_TABLE_VERSION 1
@ -52,26 +52,27 @@ enum part_status {
PART_SLOT0_INVALID = 1, PART_SLOT0_INVALID = 1,
}; };
/* Partition Table */ // Partition Table
/*- Table header */ // ----------------------------------------------------------------------
/* - 1 bytes Version */ // - Table header
/**/ // - 1 bytes Version
/*- Pre-loaded device app 1 */ //
/* - 4 bytes length. */ // - Pre-loaded device app 1
/* - 32 bytes digest. */ // - 4 bytes length.
/* - 64 bytes signature. */ // - 32 bytes digest.
/**/ // - 64 bytes signature.
/*- Pre-loaded device app 2 */ //
/* - 4 bytes length. */ // - Pre-loaded device app 2
/* - 32 bytes digest. */ // - 4 bytes length.
/* - 64 bytes signature. */ // - 32 bytes digest.
/**/ // - 64 bytes signature.
/*- Device app storage area */ //
/* - 1 byte status. */ // - Device app storage area
/* - 16 bytes random nonce. */ // - 1 byte status.
/* - 16 bytes authentication tag. */ // - 16 bytes random nonce.
/**/ // - 16 bytes authentication tag.
/*- Checksum over the above */ //
// - Checksum over the above
struct auth_metadata { struct auth_metadata {
uint8_t nonce[16]; uint8_t nonce[16];

View file

@ -18,7 +18,7 @@ static uint32_t slot_to_start_address(uint8_t slot)
return ADDR_PRE_LOADED_APP_0 + slot * SIZE_PRE_LOADED_APP; return ADDR_PRE_LOADED_APP_0 + slot * SIZE_PRE_LOADED_APP;
} }
/* Loads a preloaded app from flash to app RAM */ // Loads a preloaded app from flash to app RAM
int preload_load(struct partition_table *part_table, uint8_t from_slot) int preload_load(struct partition_table *part_table, uint8_t from_slot)
{ {
if (part_table == NULL) { if (part_table == NULL) {
@ -29,24 +29,28 @@ int preload_load(struct partition_table *part_table, uint8_t from_slot)
return -1; return -1;
} }
/* Check for a valid app in flash */ // Check for a valid app in flash
if (part_table->pre_app_data[from_slot].size == 0 && if (part_table->pre_app_data[from_slot].size == 0 &&
part_table->pre_app_data[from_slot].size <= TK1_APP_MAX_SIZE) { part_table->pre_app_data[from_slot].size <= TK1_APP_MAX_SIZE) {
return -1; return -1;
} }
uint8_t *loadaddr = (uint8_t *)TK1_RAM_BASE; uint8_t *loadaddr = (uint8_t *)TK1_RAM_BASE;
/* Read from flash, straight into RAM */ // Read from flash, straight into RAM
int ret = flash_read_data(slot_to_start_address(from_slot), loadaddr, int ret = flash_read_data(slot_to_start_address(from_slot), loadaddr,
part_table->pre_app_data[from_slot].size); part_table->pre_app_data[from_slot].size);
return ret; return ret;
} }
/* Expects to receive chunks of data up to 4096 bytes to store into the // preload_store stores chunks of an app in app slot to_slot. data is
* preloaded area. The offset needs to be kept and updated between each call. // a buffer of size size (max 4096 bytes) to be written at byte offset
* Once done, call preload_store_finalize() with the last parameters. // in the slot. offset needs to be kept and updated between each call.
* */ //
// When all data has been written call preload_store_finalize() with
// the last parameters.
//
// Returns 0 on success.
int preload_store(struct partition_table *part_table, uint32_t offset, int preload_store(struct partition_table *part_table, uint32_t offset,
uint8_t *data, size_t size, uint8_t to_slot) uint8_t *data, size_t size, uint8_t to_slot)
{ {
@ -58,12 +62,13 @@ int preload_store(struct partition_table *part_table, uint32_t offset,
return -1; return -1;
} }
/* Check if we are allowed to store */ // Check if we are allowed to store
if (!mgmt_app_authenticate()) { if (!mgmt_app_authenticate()) {
return -1; return -1;
} }
/* Check for a valid app in flash, bale out if it already exists */ // Check for a valid app in flash, bale out if it already
// exists
if (part_table->pre_app_data[to_slot].size != 0) { if (part_table->pre_app_data[to_slot].size != 0) {
return -1; return -1;
} }
@ -77,7 +82,7 @@ int preload_store(struct partition_table *part_table, uint32_t offset,
} }
if ((offset + size) > SIZE_PRE_LOADED_APP) { if ((offset + size) > SIZE_PRE_LOADED_APP) {
/* Writing outside of area */ // Writing outside of area
return -1; return -1;
} }
@ -115,12 +120,13 @@ int preload_store_finalize(struct partition_table_storage *part_table_storage,
return -1; return -1;
} }
/* Check if we are allowed to store */ // Check if we are allowed to store
if (!mgmt_app_authenticate()) { if (!mgmt_app_authenticate()) {
return -1; return -1;
} }
/* Check for a valid app in flash, bale out if it already exists */ // Check for a valid app in flash, bale out if it already
// exists
if (part_table->pre_app_data[to_slot].size != 0) { if (part_table->pre_app_data[to_slot].size != 0) {
return -1; return -1;
} }
@ -160,12 +166,12 @@ int preload_delete(struct partition_table_storage *part_table_storage,
return -1; return -1;
} }
/* Check if we are allowed to deleted */ // Check if we are allowed to delete
if (!mgmt_app_authenticate()) { if (!mgmt_app_authenticate()) {
return -1; return -1;
} }
/*Check for a valid app in flash */ // Check for a valid app in flash
if (part_table->pre_app_data[slot].size == 0) { if (part_table->pre_app_data[slot].size == 0) {
// Nothing to do. // Nothing to do.
return 0; return 0;
@ -183,7 +189,7 @@ int preload_delete(struct partition_table_storage *part_table_storage,
return -1; return -1;
} }
/* Assumes the area is 64 KiB block aligned */ // Assumes the area is 64 KiB block aligned
flash_block_64_erase( flash_block_64_erase(
slot_to_start_address(slot)); // Erase first 64 KB block slot_to_start_address(slot)); // Erase first 64 KB block
flash_block_64_erase(slot_to_start_address(slot) + flash_block_64_erase(slot_to_start_address(slot) +
@ -204,7 +210,7 @@ int preload_get_digsig(struct partition_table *part_table,
return -1; return -1;
} }
/* Check if we are allowed to read */ // Check if we are allowed to read
if (!mgmt_app_authenticate()) { if (!mgmt_app_authenticate()) {
return -1; return -1;
} }

View file

@ -1,7 +1,5 @@
/* // Copyright (C) 2022, 2023 - Tillitis AB
* Copyright (C) 2022, 2023 - Tillitis AB // SPDX-License-Identifier: GPL-2.0-only
* SPDX-License-Identifier: GPL-2.0-only
*/
#include <stdint.h> #include <stdint.h>
#include <tkey/assert.h> #include <tkey/assert.h>

View file

@ -1,7 +1,5 @@
/* // Copyright (C) 2022, 2023 - Tillitis AB
* Copyright (C) 2022, 2023 - Tillitis AB // SPDX-License-Identifier: GPL-2.0-only
* SPDX-License-Identifier: GPL-2.0-only
*/
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>

View file

@ -1,7 +1,5 @@
/* // Copyright (C) 2025 - Tillitis AB
* Copyright (C) 2025 - Tillitis AB // SPDX-License-Identifier: GPL-2.0-only
* SPDX-License-Identifier: GPL-2.0-only
*/
#include <stdint.h> #include <stdint.h>
#include <tkey/assert.h> #include <tkey/assert.h>

View file

@ -1,7 +1,5 @@
/* // Copyright (C) 2022-2025 - Tillitis AB
* Copyright (C) 2022-2025 - Tillitis AB // SPDX-License-Identifier: GPL-2.0-only
* SPDX-License-Identifier: GPL-2.0-only
*/
#include <tkey/tk1_mem.h> #include <tkey/tk1_mem.h>
@ -28,9 +26,7 @@
_start: _start:
j init j init
/* // IRQ handler
* IRQ handler
*/
.=0x10 .=0x10
irq_handler: irq_handler:
// PicoRV32 stores the IRQ bitmask in x4. // PicoRV32 stores the IRQ bitmask in x4.
@ -112,9 +108,8 @@ x3_valid:
picorv32_retirq_insn() // Return from interrupt picorv32_retirq_insn() // Return from interrupt
/* // Init
* Init
*/
.=0x100 .=0x100
init: init:
li x1, 0 li x1, 0
@ -149,7 +144,7 @@ init:
li x30,0 li x30,0
li x31,0 li x31,0
/* Clear FW_RAM */ // Clear FW_RAM
la a0, _sfwram la a0, _sfwram
la a1, _efwram la a1, _efwram
clear: clear:
@ -157,7 +152,7 @@ clear:
addi a0, a0, 4 addi a0, a0, 4
blt a0, a1, clear blt a0, a1, clear
/* Zero-init bss section */ // Zero-init bss section
la a0, _sbss la a0, _sbss
la a1, _ebss la a1, _ebss
@ -166,7 +161,7 @@ loop_init_bss:
addi a0, a0, 4 addi a0, a0, 4
blt a0, a1, loop_init_bss blt a0, a1, loop_init_bss
/* Init stack */ // Init stack
la sp, _estack la sp, _estack
call main call main

View file

@ -1,7 +1,5 @@
/* // Copyright (C) 2023 - Tillitis AB
* Copyright (C) 2023 - Tillitis AB // SPDX-License-Identifier: GPL-2.0-only
* SPDX-License-Identifier: GPL-2.0-only
*/
#ifndef STATE_H #ifndef STATE_H
#define STATE_H #define STATE_H

View file

@ -13,11 +13,9 @@
#include "partition_table.h" #include "partition_table.h"
#include "storage.h" #include "storage.h"
/* // Returns the index of the first empty area.
* Returns the index of the first empty area. //
* // Returns -1 on errors.
* Returns -1 on errors.
*/
static int get_first_empty(struct partition_table *part_table) static int get_first_empty(struct partition_table *part_table)
{ {
if (part_table == NULL) { if (part_table == NULL) {
@ -48,11 +46,9 @@ static int index_to_address(int index, uint32_t *address)
return 0; return 0;
} }
/* // Returns the index of the area an app has allocated.
* Returns the index of the area an app has allocated. //
* // Returns -1 on errors.
* Returns -1 on errors.
*/
static int storage_get_area(struct partition_table *part_table) static int storage_get_area(struct partition_table *part_table)
{ {
if (part_table == NULL) { if (part_table == NULL) {
@ -71,8 +67,9 @@ static int storage_get_area(struct partition_table *part_table)
return -1; return -1;
} }
/* Allocate a new area for an app. Returns zero if a new area is allocated, one // Allocate a new area for an app. Returns zero if a new area is
* if an area already was allocated, and negative values for errors. */ // allocated, one if an area already was allocated, and negative
// values for errors.
int storage_allocate_area(struct partition_table_storage *part_table_storage) int storage_allocate_area(struct partition_table_storage *part_table_storage)
{ {
if (part_table_storage == NULL) { if (part_table_storage == NULL) {
@ -98,15 +95,15 @@ int storage_allocate_area(struct partition_table_storage *part_table_storage)
return -3; return -3;
} }
/* Allocate the empty index found */ // Allocate the empty index found
/* Erase area first */ // Erase area first
/* Assumes the area is 64 KiB block aligned */ // Assumes the area is 64 KiB block aligned
flash_block_64_erase(start_address); // Erase first 64 KB block flash_block_64_erase(start_address); // Erase first 64 KB block
flash_block_64_erase(start_address + flash_block_64_erase(start_address +
0x10000); // Erase second 64 KB block 0x10000); // Erase second 64 KB block
/* Write partition table lastly */ // Write partition table lastly
part_table->app_storage[index].status = 0x01; part_table->app_storage[index].status = 0x01;
auth_app_create(&part_table->app_storage[index].auth); auth_app_create(&part_table->app_storage[index].auth);
@ -117,8 +114,9 @@ int storage_allocate_area(struct partition_table_storage *part_table_storage)
return 0; return 0;
} }
/* Dealloacate a previously allocated storage area. Returns zero on success, and // Dealloacate a previously allocated storage area.
* non-zero on errors. */ //
// Returns zero on success, and non-zero on errors.
int storage_deallocate_area(struct partition_table_storage *part_table_storage) int storage_deallocate_area(struct partition_table_storage *part_table_storage)
{ {
if (part_table_storage == NULL) { if (part_table_storage == NULL) {
@ -129,7 +127,7 @@ int storage_deallocate_area(struct partition_table_storage *part_table_storage)
int index = storage_get_area(part_table); int index = storage_get_area(part_table);
if (index < 0) { if (index < 0) {
/* No area to deallocate */ // No area to deallocate
return -1; return -1;
} }
@ -138,14 +136,14 @@ int storage_deallocate_area(struct partition_table_storage *part_table_storage)
return -1; return -1;
} }
/* Erase area first */ // Erase area first
/* Assumes the area is 64 KiB block aligned */ // Assumes the area is 64 KiB block aligned
flash_block_64_erase(start_address); // Erase first 64 KB block flash_block_64_erase(start_address); // Erase first 64 KB block
flash_block_64_erase(start_address + flash_block_64_erase(start_address +
0x10000); // Erase second 64 KB block 0x10000); // Erase second 64 KB block
/* Clear partition table lastly */ // Clear partition table lastly
part_table->app_storage[index].status = 0; part_table->app_storage[index].status = 0;
(void)memset(part_table->app_storage[index].auth.nonce, 0x00, (void)memset(part_table->app_storage[index].auth.nonce, 0x00,
@ -162,9 +160,11 @@ int storage_deallocate_area(struct partition_table_storage *part_table_storage)
return 0; return 0;
} }
/* Erases sector. Offset of a sector to begin erasing, must be a multiple of // Erases sector. Offset of a sector to begin erasing, must be a
* the sector size. Size to erase in bytes, must be a multiple of the sector * // multiple of the sector size. Size to erase in bytes, must be a
* size. Returns zero on success, negative error code on failure */ // multiple of the sector size.
//
// Returns zero on success, negative error code on failure
int storage_erase_sector(struct partition_table *part_table, uint32_t offset, int storage_erase_sector(struct partition_table *part_table, uint32_t offset,
size_t size) size_t size)
{ {
@ -174,7 +174,7 @@ int storage_erase_sector(struct partition_table *part_table, uint32_t offset,
int index = storage_get_area(part_table); int index = storage_get_area(part_table);
if (index == -1) { if (index == -1) {
/* No allocated area */ // No allocated area
return -1; return -1;
} }
@ -187,12 +187,12 @@ int storage_erase_sector(struct partition_table *part_table, uint32_t offset,
return -1; return -1;
} }
/* Cannot only erase entire sectors */ // Cannot only erase entire sectors
if (offset % 4096 != 0) { if (offset % 4096 != 0) {
return -1; return -1;
} }
/* Cannot erase less than one sector */ // Cannot erase less than one sector
if (size < 4096 || size > SIZE_STORAGE_AREA || size % 4096 != 0) { if (size < 4096 || size > SIZE_STORAGE_AREA || size % 4096 != 0) {
return -1; return -1;
} }
@ -215,10 +215,11 @@ int storage_erase_sector(struct partition_table *part_table, uint32_t offset,
return 0; return 0;
} }
/* Writes the specified data to the offset inside of the // Writes the specified data to the offset inside of the allocated
* allocated area. Assumes area has been erased before hand. // area. Assumes area has been erased before hand. Currently only
* Currently only handles writes to one sector, hence max size of 4096 bytes. // handles writes to one sector, hence max size of 4096 bytes.
* Returns zero on success. */ //
// Returns zero on success.
int storage_write_data(struct partition_table *part_table, uint32_t offset, int storage_write_data(struct partition_table *part_table, uint32_t offset,
uint8_t *data, size_t size) uint8_t *data, size_t size)
{ {
@ -234,7 +235,7 @@ int storage_write_data(struct partition_table *part_table, uint32_t offset,
int index = storage_get_area(part_table); int index = storage_get_area(part_table);
if (index == -1) { if (index == -1) {
/* No allocated area */ // No allocated area
return -1; return -1;
} }
@ -252,7 +253,7 @@ int storage_write_data(struct partition_table *part_table, uint32_t offset,
} }
if ((offset + size) > SIZE_STORAGE_AREA) { if ((offset + size) > SIZE_STORAGE_AREA) {
/* Writing outside of area */ // Writing outside of area
return -1; return -1;
} }
@ -265,9 +266,12 @@ int storage_write_data(struct partition_table *part_table, uint32_t offset,
return flash_write_data(address, data, size); return flash_write_data(address, data, size);
} }
/* Reads size bytes of data at the specified offset inside of // Reads size bytes of data at the specified offset inside of the
* the allocated area. Returns zero on success. Only read limit // allocated area.
* is the size of the allocated area */ //
// Only read limit is the size of the allocated area.
//
// Returns zero on success.
int storage_read_data(struct partition_table *part_table, uint32_t offset, int storage_read_data(struct partition_table *part_table, uint32_t offset,
uint8_t *data, size_t size) uint8_t *data, size_t size)
{ {
@ -283,7 +287,7 @@ int storage_read_data(struct partition_table *part_table, uint32_t offset,
int index = storage_get_area(part_table); int index = storage_get_area(part_table);
if (index == -1) { if (index == -1) {
/* No allocated area */ // No allocated area
return -1; return -1;
} }
@ -302,7 +306,7 @@ int storage_read_data(struct partition_table *part_table, uint32_t offset,
} }
if ((offset + size) > SIZE_STORAGE_AREA) { if ((offset + size) > SIZE_STORAGE_AREA) {
/* Reading outside of area */ // Reading outside of area
return -1; return -1;
} }

View file

@ -13,7 +13,7 @@
syscall_enable: syscall_enable:
/* Enable syscall IRQ */ // Enable syscall IRQ
li t0, 0x7fffffff // IRQ31 mask li t0, 0x7fffffff // IRQ31 mask
picorv32_maskirq_insn(zero, t0) // Enable IRQs picorv32_maskirq_insn(zero, t0) // Enable IRQs

View file

@ -1,7 +1,5 @@
/* // Copyright (C) 2025 - Tillitis AB
* Copyright (C) 2025 - Tillitis AB // SPDX-License-Identifier: GPL-2.0-only
* SPDX-License-Identifier: GPL-2.0-only
*/
#include <stdint.h> #include <stdint.h>
#include <tkey/assert.h> #include <tkey/assert.h>