4
4
5
5
The [ Nitrogen6 SoloX] [ solox ] SoC has both an A9 core and an M4 core.
6
6
7
- The seL4 root task runs on the A9 core .
7
+ Here's a good [ article ] [ bd-article ] that describes the platform .
8
8
9
- It first initializes the system, then runs a separate Rust application on the M4 core.
9
+ See the [ TRM] [ trm ] for register details.
10
+
11
+ ## About the project
12
+
13
+ The seL4 kernel, root-task and threads run on the A9 core.
14
+
15
+ A bare metal Rust cortex-m project runs on the M4 core.
16
+
17
+ - U-boot does initial bootstrapping of the A9 core and loads the master ELF binary
18
+ - seL4 kernel is started on the A9 core
19
+ - seL4 root task initializes some memory, devices and I/O for a thread
20
+ - seL4 thread loads the M4 core firmware from the CPIO archive linked into the master ELF binary
21
+ - seL4 thread starts up the M4 core and clock
10
22
11
23
## Building
12
24
25
+ ** REQUIRES a cargo-fel4 that doesn't overwrite the root-task.rs **
26
+
13
27
Note that the L2 cache memory is currently defined as OCRAM for the M4 core.
14
28
15
29
Modify U-boot environment:
@@ -18,7 +32,7 @@ Modify U-boot environment:
18
32
# default loadaddr
19
33
loadaddr=0x82000000
20
34
21
- # move it up a bit so we don't overlap with the elf-loader
35
+ # move it up a bit so we don't overlap with the elf-loader, Rust binaries are big right now
22
36
setenv loadaddr 0x83000000
23
37
24
38
# boot alias command
@@ -31,8 +45,148 @@ Apply local patches to convert the imx6/sabre-lite platform into something the S
31
45
./scripts/apply-patches
32
46
33
47
# a build.rs script is used to invoke the 'm4-firmware' project build
48
+ # required because we can't have a normal dependency on a thing for a different target (A9/M4)
34
49
cargo fel4 build
35
50
```
36
51
52
+ ## Running
53
+
54
+ On UART1 (U-boot/A9) console:
55
+
56
+ ``` text
57
+ U-Boot 2017.07-28767-g87d490f (Jun 20 2018 - 10:29:54 -0700)
58
+
59
+ CPU: Freescale i.MX6SX rev1.3 at 792 MHz
60
+ Reset cause: POR
61
+ Board: nitrogen6sx
62
+ I2C: ready
63
+ DRAM: 1 GiB
64
+ MMC: FSL_SDHC: 0, FSL_SDHC: 1
65
+ SF: Detected sst25vf016b with page size 256 Bytes, erase size 4 KiB, total 2 MiB
66
+ Display: lcd:1280x720M@60 (1280x720)
67
+ In: serial
68
+ Out: serial
69
+ Err: serial
70
+ Net: AR8035 at 4
71
+ AR8035 at 5
72
+ FEC0 [PRIME], FEC1, usb_ether
73
+ Hit any key to stop autoboot: 0
74
+ Using FEC0 device
75
+ Filename 'feL4img'.
76
+ Load address: 0x83000000
77
+ Loading: #################################################################
78
+ ############################
79
+ 7.7 MiB/s
80
+ done
81
+ Bytes transferred = 1363524 (14ce44 hex)
82
+ ## Starting application at 0x83000000 ...
83
+
84
+ ELF-loader started on CPU: ARM Ltd. Cortex-A9 r2p10
85
+ paddr=[83000000..8315ffff]
86
+ ELF-loading image 'kernel'
87
+ paddr=[80000000..80032fff]
88
+ vaddr=[e0000000..e0032fff]
89
+ virt_entry=e0000000
90
+ ELF-loading image 'root-task'
91
+ paddr=[80033000..82080fff]
92
+ vaddr=[10000..205dfff]
93
+ virt_entry=10554
94
+ Enabling MMU and paging
95
+ Jumping to kernel-image entry point...
96
+
97
+ Bootstrapping kernel
98
+ Booting all finished, dropped to user space
99
+ feL4 app init
100
+
101
+ hello from a feL4 thread!
102
+
103
+ SRC paddr = 0x20D8000 -- vaddr = 0x10000000
104
+ CCM paddr = 0x20C4000 -- vaddr = 0x10001000
105
+ TCM paddr = 0x7F8000 -- vaddr = 0x10002000
106
+
107
+ created new CPIO reader
108
+ Reader {
109
+ archive_size: 3584,
110
+ base_ptr: 0x00044010
111
+ }
112
+
113
+ parsed CPIO entry 'm4-firmware.bin'
114
+
115
+ enabling M4 core clock
116
+ copying M4 binary to TCM - 3044 bytes
117
+ enabling and starting the M4 core
118
+ waiting for SRC_SCR reset auto-clear (bit 3) to clear
119
+
120
+ thread work all done, sitting on loop
121
+ ```
122
+
123
+ On UART2 (M4) console:
124
+
125
+ ``` text
126
+ M4 core is up and running
127
+
128
+ Hello world from Rust on Cortex-M4
129
+ Hello world from Rust on Cortex-M4
130
+ Hello world from Rust on Cortex-M4
131
+ Hello world from Rust on Cortex-M4
132
+ Hello world from Rust on Cortex-M4
133
+ Hello world from Rust on Cortex-M4
134
+ ...
135
+ ```
136
+
137
+ ### A9 Test Deployment
138
+
139
+ ``` bash
140
+ tftp ${a9ocramloadaddr} ${serverip} :a9.bin
141
+
142
+ go ${a9ocramloadaddr}
143
+ ```
144
+
145
+ ### M4 Test Deployment
146
+
147
+ ``` bash
148
+ tftp ${m4loadaddr} ${serverip} :m4.bin
149
+
150
+ dcache flush
151
+
152
+ bootaux ${m4loadaddr}
153
+ ```
154
+
155
+ ## Notes
156
+
157
+ ### L2 Cache
158
+
159
+ seL4 is attempting to use the TCM region for L2 cache.
160
+ Since we're using it for the M4 core, can we instead use the
161
+ region at ` 0x009C_0000 ` ; which is 256 KB, labeled as
162
+ ` L2 cache memory used as OCRAM aliased ` ?
163
+
164
+ Could just be an issue with my config.
165
+
166
+ L2 cache is configured as OCRAM by default I think.
167
+ See Table 8-2 in the TRM, fuse ` USE_L2_CACHE_AS_OCRAM BOOT_CFG2 ` .
168
+
169
+ ### Memory Map
170
+
171
+ The i.MX6 SoloX has two cores with different address mapping.
172
+
173
+ The ARM IP Bus (AIPS) memory map shows there is a ` 0x4000_0000 ` offset
174
+ from the A9's address space to the M4's.
175
+
176
+ Refer to Table 2-1 (System memory map) for Cortex-A9 core and
177
+ to Table 2-2 (CM4 memory map) for Cortex-M4 of the i.MX6 SoloX
178
+ reference ranual.
179
+
180
+ To run Cortex-M4 it is needed to fill ` TCM(L) ` , that
181
+ is addressed as ` TCML ALIAS ` (from zero).
182
+
183
+ The same memory is mapped to ` 0x007f8000 ` of the
184
+ Cortex-A9 (non-reflected in the Table 2-1).
185
+
186
+ Note, this area is accessible by the Cortex-A9 after M4 clock
187
+ is enabled in ` CCM_CCGR3 ` .
188
+
37
189
[ solox ] : https://boundarydevices.com/product/nit6_solox-imx6/
190
+ [ bd-article ] : https://boundarydevices.com/using-the-cortex-m4-mcu-on-the-nit6_solox/
191
+ [ trm ] : http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6SXRM.pdf
38
192
[ open-amp ] : https://github.com/OpenAMP/open-amp/wiki
0 commit comments