added v2.0
This commit is contained in:
1
07_Operating_System/01_GPIO_Test/GPIO.jack
Symbolic link
1
07_Operating_System/01_GPIO_Test/GPIO.jack
Symbolic link
@@ -0,0 +1 @@
|
||||
../GPIO.jack
|
18
07_Operating_System/01_GPIO_Test/Makefile
Normal file
18
07_Operating_System/01_GPIO_Test/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
all: jack vm asm bin sim
|
||||
|
||||
jack:
|
||||
../../tools/JackCompiler/JackCompiler.pyc ./
|
||||
vm:
|
||||
../../tools/VMTranslator/VMTranslator.pyc ./
|
||||
asm:
|
||||
../../tools/Assembler/assembler.pyc out.asm
|
||||
bin:
|
||||
../../tools/AsciiToBin.py out.hack
|
||||
sim:
|
||||
cp out.hack ../00_HACK/ROM.hack
|
||||
upload:
|
||||
iceprogduino -o 64k -w out.bin
|
||||
clean:
|
||||
rm -f *.vm *.asm *.hack *.bin *~
|
||||
|
||||
.PHONY: all clean
|
50
07_Operating_System/01_GPIO_Test/Readme.md
Normal file
50
07_Operating_System/01_GPIO_Test/Readme.md
Normal file
@@ -0,0 +1,50 @@
|
||||
## GPIO.jack
|
||||
|
||||
This library provides access to `BUT` and `LED`.
|
||||
|
||||
### GPIO-Test
|
||||
|
||||
In the Testfolder `01_GPIO_Test` you find a minimal version of `Sys.jack` containing the init function `Sys.init()`, which is called after starting JACK-OS. `Sys.init()` is the JACK-OS version of `leds.asm`, which reads the BUT and writes the values to LED in an endless loop:
|
||||
|
||||
```
|
||||
class Sys {
|
||||
|
||||
function void init() {
|
||||
do GPIO.init(4096);
|
||||
while (true){
|
||||
do GPIO.writeLed(GPIO.readBut());
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### Project
|
||||
|
||||
* Implement `GPIO.jack`
|
||||
|
||||
* Test in simulation:
|
||||
|
||||
```
|
||||
$ cd 01_GPIO_Test
|
||||
$ make
|
||||
$ cd ../00_HACK
|
||||
$ apio clean
|
||||
$ apio sim
|
||||
```
|
||||
|
||||
The test bench will simulate the pushing of BUT1/2. Check if the LED change accordingly.
|
||||
|
||||

|
||||
|
||||
* run in real hardware with HACK build at `06_IO_Devices/05_GO` (together with the bootloader). Build and upload GPIO_Test to iCE40HX1K-EVB with:
|
||||
|
||||
```
|
||||
$ cd 01_GPIO_Test
|
||||
$ make
|
||||
$ make upload
|
||||
```
|
||||
|
||||
* push buttons BUT on iCE40HX1K-EVB and check the LED.
|
49
07_Operating_System/01_GPIO_Test/Readme.md.backup
Normal file
49
07_Operating_System/01_GPIO_Test/Readme.md.backup
Normal file
@@ -0,0 +1,49 @@
|
||||
## GPIO.jack
|
||||
This library provides access to `BUT` and `LED`.
|
||||
### function void init(int addr)
|
||||
Initialize LED (addr) and BUT (addr+1).
|
||||
### function int readLed()
|
||||
Returns the value of LED.
|
||||
### function void writeLed(int c)
|
||||
Write c to LED.
|
||||
### function int readBut()
|
||||
Returns the state of BUT.
|
||||
|
||||
***
|
||||
## Project
|
||||
In the Testfolder `01_GPIO_Test` you find a minimal version of `Sys.jack` containing the init function `Sys.init()`, which is called after starting JACK-OS. `Sys.init()` is the JACK-OS version of `leds.asm`, which reads the BUT and writes the values to LED in an endless loop:
|
||||
|
||||
```
|
||||
class Sys {
|
||||
|
||||
function void init() {
|
||||
do GPIO.init(4096);
|
||||
while (true){
|
||||
do GPIO.writeLed(GPIO.readBut());
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
* Implement `GPIO.jack`
|
||||
* Test in simulation:
|
||||
```
|
||||
$ cd 01_GPIO_Test
|
||||
$ make
|
||||
$ cd ../00_HACK
|
||||
$ apio clean
|
||||
$ apio sim
|
||||
```
|
||||
The test bench will simulate the pushing of BUT1/2. Check if the LED change accordingly.
|
||||
|
||||

|
||||
|
||||
* run in real hardware with HACK build at `06_IO_Devices/05_GO` (together with the bootloader). Build and upload GPIO_Test to iCE40HX1K-EVB with:
|
||||
```
|
||||
$ cd 01_GPIO_Test
|
||||
$ make
|
||||
$ make upload
|
||||
```
|
||||
|
||||
* push buttons BUT on iCE40HX1K-EVB and check the LED.
|
15
07_Operating_System/01_GPIO_Test/Sys.jack
Normal file
15
07_Operating_System/01_GPIO_Test/Sys.jack
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* A library that supports various program execution services.
|
||||
*/
|
||||
class Sys {
|
||||
|
||||
/** Performs all the initializations required by the OS. */
|
||||
function void init() {
|
||||
do GPIO.init(4096);
|
||||
while (true){
|
||||
do GPIO.writeLed(GPIO.readBut());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
BIN
07_Operating_System/01_GPIO_Test/gpio.png
Normal file
BIN
07_Operating_System/01_GPIO_Test/gpio.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 61 KiB |
Reference in New Issue
Block a user