GR712RC unit tests 1.0
Bare-metal C++ hardware tests for the PLATO DPU (IAA-CSIC, 2019)
Loading...
Searching...
No Matches
memory_run.cpp
Go to the documentation of this file.
1
18
19#include <cstdint>
20#include <mcal/mcal.h>
21
22int main()
23{
24
25 constexpr std::uint32_t def_pattern = 0xABABABABUL;
26
27 mcal::init(nullptr);
28
29 //Configure memory access
30 std::uint32_t *memory_begin_position = reinterpret_cast<std::uint32_t *>(mcal::reg::mem_base_addr);
31 std::uint32_t *memory_end_position = reinterpret_cast<std::uint32_t *>(mcal::reg::mem_end_addr);
32
33 volatile std::uint32_t *memory_position = memory_begin_position;
34 while( memory_position < memory_end_position )
35 {
36 (* memory_position ) = def_pattern;
37
38 memory_position ++;
39 }
40
41 volatile std::uint32_t *memory_check_position = memory_begin_position;
42 while( memory_check_position < memory_end_position )
43 {
44 if ((*memory_check_position) == def_pattern)
45 {
46 memory_check_position ++;
47 }
48 else
49 {
50 return 1;
51 }
52
53 }
54
55
56 return 0;
57}
Microcontroller abstraction layer.
int main()
constexpr std::uint32_t mem_base_addr
Definition mcal_reg.h:16
constexpr std::uint32_t mem_end_addr
Definition mcal_reg.h:17
void init(config_type *)
Definition mcal.cpp:12