Update simulation gitignore
[gram.git] / libgram / README.md
1 # libgram, the C companion for gram
2
3 libgram is the C library for gram core initialization and memory testing.
4
5 ## HowTo
6
7 Build libgram with make. In your firmware:
8
9 ```C
10 #include <gram.h>
11
12 int main(void) {
13 struct gramCtx ctx;
14 int err = gram_init(&ctx, 0x10000000, 0x00006000, 0x00005000);
15
16 return 0;
17 }
18 ```
19
20 Link it to this library and you should be good to go!
21
22 ## Error handling
23
24 ```
25 GRAM_ERR_NONE: No error happened (hardcoded to zero)
26 GRAM_ERR_UNDOCUMENTED: Undocumented error, shame on us lazy coders (take a look at the code)
27 ```
28
29 ## Using libgram outside the SoC
30
31 Compile libgram with `CFLAGS="-DGRAM_RW_FUNC"` (run `make clean` beforehand) and define the following bus access functions:
32
33 ```c
34 uint32_t gram_read(struct gramCtx *ctx, void *addr);
35 int gram_write(struct gramCtx *ctx, void *addr, uint32_t value);
36 ```
37
38 If you want to use the default compiler on your computer, use `CFLAGS="-DGRAM_RW_FUNC" make TRIPLE=""`.