-
Hi everyone, The problem is that in my program I want to save the generated round keys so I used "neorv32_cpu_load_unsigned_word()" function but I get a "Load access fault [TIMEOUT_ERR] " when I try to save in specific addresses. I'm simulating the processor with makefiles in the console. Is something wrong with my code? I attached my code and the output I get in the files below. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey Jimmy!
Interesting project! 👍
It is always "dangerous" to use hard-coded pointers in C (however, I also do that a lot). 😅 In the case of your application, you are manually accessing a memory region starting at 📚 The available address space / memories provided by the default testbench are listed in Table 3 in UG: 14.1. Testbench. I would recommend to use a simple array and let the compiler do the address mapping. So, instead of accessing memory using a pointer // key shedule
uint32_t addr, data;
addr = 0xA0000000;
// save first round key lsb
data = (uint32_t) key.high64;
neorv32_cpu_store_unsigned_word(addr, data);
addr += 4;
...
// save round key LSB
data = (uint32_t) key.high64;
neorv32_cpu_store_unsigned_word(addr, data);
addr += 4;
...
// print saved round keys (LSB)
addr = 0xA0000000;
for (uint8_t i = 0; i < 32; i++) {
data = neorv32_cpu_load_unsigned_word(addr);
addr += 4;
neorv32_uart0_printf("%d: %x\n", i, data);
} just use a plain array with an index: // key shedule
uint32_t data[32];
// save first round key lsb
data[0] = (uint32_t) key.high64;
...
// save round key LSB
data[i] = (uint32_t) key.high64;
...
// print saved round keys (LSB)
for (uint8_t i = 0; i < 32; i++) {
neorv32_uart0_printf("%d: %x\n", i, data[i]);
} |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply! It was very helpful. |
Beta Was this translation helpful? Give feedback.
Hey Jimmy!
Interesting project! 👍
This seems a like a great application for the processor's Custom Functions Unit. 😄
It is always "dangerous" to use hard-coded pointers in C (however, I also do that a lot). 😅 In the case of your application, you are manually accessing a memory region starting at
0xA0000000
. But the default testbench does not provide any me…