GR712RC unit tests 1.0
Bare-metal C++ hardware tests for the PLATO DPU (IAA-CSIC, 2019)
Loading...
Searching...
No Matches
memory_run_bucle.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 = 0xA5A5A5A5UL;
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 while(1)
34 {
35 volatile std::uint32_t *memory_position = memory_begin_position;
36 while( memory_position < memory_end_position )
37 {
38 (* memory_position ) = def_pattern;
39
40 memory_position ++;
41 }
42
43 volatile std::uint32_t *memory_check_position = memory_begin_position;
44 while( memory_check_position < memory_end_position )
45 {
46 if ((*memory_check_position) == def_pattern)
47 {
48 memory_check_position ++;
49 }
50 else
51 {
52 return 1;
53 }
54
55 }
56
57 }
58
59 return 0;
60}
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