mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-03-12 10:06:47 -04:00
PoC: testfw: Check that SPI flash is available in firmware mode
This commit is contained in:
parent
52694b5c4f
commit
3665c3e245
@ -147,7 +147,9 @@ TESTFW_OBJS = \
|
|||||||
$(P)/fw/testfw/main.o \
|
$(P)/fw/testfw/main.o \
|
||||||
$(P)/fw/testfw/start.o \
|
$(P)/fw/testfw/start.o \
|
||||||
$(P)/fw/tk1/proto.o \
|
$(P)/fw/tk1/proto.o \
|
||||||
$(P)/fw/tk1/lib.o
|
$(P)/fw/tk1/lib.o \
|
||||||
|
$(P)/fw/tk1/spi.o \
|
||||||
|
$(P)/fw/tk1/flash.o
|
||||||
|
|
||||||
IRQPOC_OBJS = \
|
IRQPOC_OBJS = \
|
||||||
$(P)/fw/irqpoc/main.o \
|
$(P)/fw/irqpoc/main.o \
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
* SPDX-License-Identifier: GPL-2.0-only
|
* SPDX-License-Identifier: GPL-2.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "../tk1/flash.h"
|
||||||
#include "../tk1/lib.h"
|
#include "../tk1/lib.h"
|
||||||
#include "../tk1/proto.h"
|
#include "../tk1/proto.h"
|
||||||
#include "../tk1/types.h"
|
#include "../tk1/types.h"
|
||||||
@ -239,6 +240,16 @@ int main(void)
|
|||||||
anyfailed = 1;
|
anyfailed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t jedec_id[3];
|
||||||
|
puts("\r\nReading SPI flash capacity...\r\n");
|
||||||
|
flash_release_powerdown();
|
||||||
|
flash_read_jedec_id(jedec_id);
|
||||||
|
|
||||||
|
if (jedec_id[2] != 0x14) {
|
||||||
|
failmsg("Expected SPI flash capacity: 0x14 (1 MByte)");
|
||||||
|
anyfailed = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Test FW_RAM.
|
// Test FW_RAM.
|
||||||
puts("\r\nTesting FW_RAM (takes 15s on hw)...\r\n");
|
puts("\r\nTesting FW_RAM (takes 15s on hw)...\r\n");
|
||||||
for (unsigned int i = 0; i < TK1_MMIO_FW_RAM_SIZE; i++) {
|
for (unsigned int i = 0; i < TK1_MMIO_FW_RAM_SIZE; i++) {
|
||||||
|
@ -4,9 +4,8 @@
|
|||||||
#ifndef TKEY_FLASH_H
|
#ifndef TKEY_FLASH_H
|
||||||
#define TKEY_FLASH_H
|
#define TKEY_FLASH_H
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define WRITE_ENABLE 0x06
|
#define WRITE_ENABLE 0x06
|
||||||
#define WRITE_DISABLE 0x04
|
#define WRITE_DISABLE 0x04
|
||||||
|
Loading…
x
Reference in New Issue
Block a user