You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-19Lines changed: 21 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,16 @@
1
-
ulptool v2.4.0
1
+
ulptool v2.4.1
2
2
==================
3
-
This guide explains how to setup Arduino to use ULP coprocessor assembly files for your esp32 projects. This guide assumes you installed the esp32 core with the preferred method of the board manager.
3
+
Now Arduino can program the ULP coprocessor for your esp32 projects. The guide below assumes you installed the esp32 core with the preferred method using the board manager.
4
4
5
-
Typically in Arduino you can compile assembly files using the '.S' extension. Using the ESP32 Arduino core framework these files would correspond to the Xtensa processors whose toolchain is incompatible with the ULP coprocessor. Luckily, Arduino provides a fairly easy albeit not that flexible build framework using series of recipes. This guide extends those esp32 recipes for building the ULP assembly files. We will use the '.s' extensions for ULP assembly files which Arduino will let you create. Remember thats a lower case 's'. I tried to keep the ulp build process the same as the esp-if framework with only a few small modifications the user needs to do in order to compile in Arduino.
5
+
Typically in Arduino you can compile assembly files using the '.S' extension. Using the ESP32 Arduino core framework these files would correspond to the Xtensa processors whose toolchain is incompatible with the ULP coprocessor. Luckily, Arduino provides a fairly easy series of recipesfor building the ULP assembly files by using the '.s' extension which Arduino will let you create. Take note, the extension is a lower case **s**. In tring to keep the ulp build process the same as the esp-idf framework only a few small modifications are needed to the esp32 Arduino installation.
6
6
7
-
New experimental c compiler (lcc) for the ulp implemented by Jason Fuller included now. Currently only Mac and Linux have been built but hopefully we will have Windows soon. There are many limitations and those can found at his github page here: https://github.com/jasonful/lcc
7
+
A new experimental c compiler (lcc) for the ulp implemented by Jason Fuller is included now. Currently only Mac and Linux have been built but hopefully I'll have Windows soon:) There are many limitations and those can found at his github page here: https://github.com/jasonful/lcc
8
8
Examples can be found in the ulp_examples/ulpcc folder.
9
9
10
+
Note - platform.local.txt version does not follow ulptool version.
11
+
10
12
Manual Setup Steps:
11
-
============
13
+
==================
12
14
1. Download the latest release of this repository and unpack-> https://github.com/duff2013/ulptool/releases/latest
13
15
delete the release version number so the folder is just called 'ulptool'
14
16
@@ -22,19 +24,19 @@ delete the release version number so the folder is just called 'ulptool'
22
24
23
25
Typically (Linux) -> ~/.arduino15/packages/esp32
24
26
25
-
4. Move the **ulptool** folder you downloaded and unpacked to the tools folder here -> **.../esp32/tools/**.
27
+
4. Move the **ulptool** folder you downloaded and unpacked to the tools folder here -> **.../esp32/tools/ulptool/**.
26
28
27
29
5. Copy the 'platform.local.txt' file to **... /esp32/hardware/esp32/1.0.0/**. Remember **1.0.0** has to match your esp32 core version.
28
30
29
-
6. In the **ulptool**release you downloaded, move or copy the **... /esp32/tools/ulptool/src/ulp_examples** folder to where Arduino saves your sketches.
31
+
6. In the **ulptool**folder, move or copy the **... /ulptool/src/ulp_examples** folder to where Arduino saves your sketches.
30
32
31
-
7. Move **esp32ulp-elf-binutils** folder you downloaded and unpacked to -> **... /esp32/tools/ulptool/src/**.
33
+
7. Move **esp32ulp-elf-binutils** folder you downloaded and unpacked to -> **... /esp32/tools/ulptool/src/esp32ulp-elf-binutils/**.
32
34
33
-
Thats it, you now have all the files in place, lets look at very simple example to get you compiling ulp assembly code!
35
+
That's it, you now have all the files in place, lets look at very simple example to get you compiling ulp assembly code!
34
36
35
-
Example:
36
-
========
37
-
Open a blank Arduino sketch and copy and paste the code below into the that sketch.
37
+
Assembly Example:
38
+
-----------------
39
+
Open a blank Arduino sketch and copy and paste the code below into that sketch.
Create a new tab named <b>ulp.s</b>, take notice that the extension is a lower case 's'. Copy the code below into that ulp assembly file tab.
78
+
Create a new tab named <b>ulp.s</b>, take notice that the extension is a lower case **s**. Copy the code below into the ulp assembly file you just created.
77
79
```
78
80
/* Define variables, which go into .bss section (zero-initialized data) */
79
81
.bss
@@ -93,7 +95,7 @@ entry:
93
95
halt
94
96
```
95
97
96
-
Create a new tab named <b>ulp_main.h</b>. This header allows your sketch to see global variables whose memory is allocated in your ulp assembly file. This memory is in the SLOW RTC section. Copy the code below into that header file. As with the esp-idf you have to add 'ulp_' to the front of the variable name. Unlike esp-idf the name of this header is always this name.
98
+
Create a new tab named <b>ulp_main.h</b>. This header allows your sketch to see global variables whose memory is allocated in your ulp assembly file. This memory is from the SLOW RTC section. Copy the code below into the header file. As with the esp-idf you have to add 'ulp_' to the front of the variable name. Unlike esp-idf the name of this header is always **ulp_main.h**.
97
99
```
98
100
/*
99
101
Put your ULP globals here you want visibility
@@ -106,9 +108,9 @@ extern uint32_t ulp_entry;
106
108
extern uint32_t ulp_count;
107
109
```
108
110
109
-
Compile and run and you should see the variable 'ulp_count' increment every 100 msecs.
111
+
Upload the code then open your serial monitor, you should see the variable 'ulp_count' increment every 100 msecs.
110
112
111
-
ULPCC Examples:
113
+
ULPCC Example:
112
114
---------------
113
115
Open a blank Arduino sketch and copy and paste the code below into the that sketch. This is basically the same as the example above but written in c:)
114
116
```
@@ -167,7 +169,7 @@ void entry() {
167
169
#endif // do not add code after here
168
170
```
169
171
170
-
Create a new tab named <b>ulp_main.h</b>. This header allows your sketch to see global variables whose memory is allocated in your ulp c file. This memory is in the SLOW RTC section. Copy the code below into that header file. As with the esp-idf you have to add 'ulp_' to the front of the variable name. Unlike esp-idf the name of this header is always this name.
172
+
Create a new tab named <b>ulp_main.h</b>. This header allows your sketch to see global variables whose memory is allocated in your ulp assembly file. This memory is from the SLOW RTC section. Copy the code below into the header file. As with the esp-idf you have to add 'ulp_' to the front of the variable name. Unlike esp-idf the name of this header is always **ulp_main.h**.
171
173
```
172
174
/*
173
175
Put your ULP globals here you want visibility
@@ -181,11 +183,11 @@ extern uint32_t ulp_entry;
181
183
extern uint32_t ulp_counter;
182
184
```
183
185
184
-
Compile and run and you should see the variable 'ulp_counter' increment every 100 msecs.
186
+
Upload the code then open your serial monitor, you should see the variable 'ulp_counter' increment every 100 msecs.
185
187
186
188
Under the Hood:
187
189
===============
188
-
All the magic happens in the python script called esp32ulp_build_recipe.py. This along with espressif's esp32ulp_mapgen.py in which both are located in the ulp directory from this repository.
190
+
All the magic happens in the python script called esp32ulp_build_recipe.pyalong with espressif's esp32ulp_mapgen.py script.
0 commit comments