diff --git a/simppru-examples/button_click_rpmsg.rst b/simppru-examples/button_click_rpmsg.rst index f21807fb41500190c615352472f41b74dafe8fc9..ac10f3f399e52bad8faa98c256338961bbe08b5d 100644 --- a/simppru-examples/button_click_rpmsg.rst +++ b/simppru-examples/button_click_rpmsg.rst @@ -1,12 +1,11 @@ Sending state of button using RPMSG =================================== -!!! info “Schematic†=== “Pocket Beagle†|image0| - -:: - - === "BeagleBone Black / Beagle Bone Black Wireless" -  +.. image:: images/led_button_pocket_beagle.png + :width: 598 + :align: center + :height: 400 + :alt: Sending state of button using RPMSG Code ---- diff --git a/simppru-examples/delay.rst b/simppru-examples/delay.rst index 7d6ead6ce927384fd5d6b7f056568b50fa39bc55..2f04b3bb8e1c55423179e7e04fca4d66ec2f1a96 100644 --- a/simppru-examples/delay.rst +++ b/simppru-examples/delay.rst @@ -1,12 +1,12 @@ Delay example ============= -!!! info “Schematic†=== “Pocket Beagle†|image0| +.. image:: images/led_pocket_beagle.png + :width: 598 + :align: center + :height: 400 + :alt: Delay example -:: - - === "BeagleBone Black / Beagle Bone Black Wireless" -  Code ---- @@ -30,4 +30,3 @@ using the ``delay`` call, after that it writes LOW to header pin P1_31, then again waits for 5000ms using the ``delay`` call, and finally writes HIGH to header pin P1_31. -.. |image0| image:: images/led_pocket_beagle.png \ No newline at end of file diff --git a/simppru-examples/digital_read.rst b/simppru-examples/digital_read.rst index c39930612ddf5386ca6901753fa0234991d7b46f..9563db3a849fab8cb2a217fe1284c7e2b290753d 100644 --- a/simppru-examples/digital_read.rst +++ b/simppru-examples/digital_read.rst @@ -1,12 +1,11 @@ Digital read example ==================== -!!! info “Schematic†=== “Pocket Beagle†|image0| - -:: - - === "BeagleBone Black / Beagle Bone Black Wireless" -  +.. image:: images/led_button_pocket_beagle.png + :width: 598 + :align: center + :height: 400 + :alt: Digital read example Code ---- @@ -33,4 +32,3 @@ This code runs a never ending loop, since it is ``while : true``. Inside P1_29 is HIGH, header pin P1_31 is set to LOW, and if header pin P1_29 is LOW, header pin P1_31 is set to HIGH. -.. |image0| image:: images/led_button_pocket_beagle.png \ No newline at end of file diff --git a/simppru-examples/digital_write.rst b/simppru-examples/digital_write.rst index 45997aa502d5be6255a1ac21ecbb775a0a5d8f22..154ad1b1d5ea474ee2ea7a2f8b2f178f4da69384 100644 --- a/simppru-examples/digital_write.rst +++ b/simppru-examples/digital_write.rst @@ -1,12 +1,11 @@ Digital write example ===================== -!!! info “Schematic†=== “Pocket Beagle†|image0| - -:: - - === "BeagleBone Black / Beagle Bone Black Wireless" -  +.. image:: images/led_pocket_beagle.png + :width: 598 + :align: center + :height: 400 + :alt: Digital write example Code ---- @@ -26,4 +25,3 @@ Explaination This code runs a never ending loop, since it is ``while : true``. Inside ``while`` it sets header pin P1_31 to HIGH. -.. |image0| image:: images/led_pocket_beagle.png diff --git a/simppru-examples/hcsr04_example_rpmsg.rst b/simppru-examples/hcsr04_example_rpmsg.rst index 91fa3eccb06a4a953074c3a7b7161dcdece719ee..4f54acc201afa93194cc98d000e6b68aaa0b877a 100644 --- a/simppru-examples/hcsr04_example_rpmsg.rst +++ b/simppru-examples/hcsr04_example_rpmsg.rst @@ -1,12 +1,11 @@ HCSR04 Distance Sensor example (sending distance data to ARM using RPMSG) ========================================================================= -!!! info “Schematic†=== “Pocket Beagle†|image0| - -:: - - === "BeagleBone Black / Beagle Bone Black Wireless" -  +.. image:: images/hcsr04_pocket_beagle.png + :width: 598 + :align: center + :height: 400 + :alt: HCSR04 Distance Sensor example Code ---- diff --git a/simppru-examples/hcsr04_sensor.rst b/simppru-examples/hcsr04_sensor.rst index b246c1ca87392a6eb4fe464fb8329c30c0c0e552..f2005a9c024a1de79f0296144f29039197acddff 100644 --- a/simppru-examples/hcsr04_sensor.rst +++ b/simppru-examples/hcsr04_sensor.rst @@ -1,12 +1,11 @@ Ultrasonic range sensor example =============================== -!!! info “Schematic†=== “Pocket Beagle†|image0| - -:: - - === "BeagleBone Black / Beagle Bone Black Wireless" -  +.. image:: images/hcsr04_pocket_beagle.png + :width: 598 + :align: center + :height: 400 + :alt: Ultrasonic range sensor example Code ---- diff --git a/simppru-examples/images/simpPRU.png b/simppru-examples/images/simpPRU.png new file mode 100644 index 0000000000000000000000000000000000000000..8bd57d860b6b740b9d44ad037cc5d709722ff060 Binary files /dev/null and b/simppru-examples/images/simpPRU.png differ diff --git a/simppru-examples/index.rst b/simppru-examples/index.rst index 82f8593265d0f67b955b72980e355c95b4a6cfd8..c0bc8b26577ae1b5232eeeb163ac4f8d3bf6dd6c 100644 --- a/simppru-examples/index.rst +++ b/simppru-examples/index.rst @@ -3,53 +3,32 @@ simpPRU Examples ############## -The PRU is a dual core micro-controller system present on the AM335x SoC -which powers the BeagleBone. It is meant to be used for high speed -jitter free IO control. Being independent from the linux scheduler and -having direct access to the IO pins of the BeagleBone Black, the PRU is -ideal for offloading IO intensive tasks. - -Programming the PRU is a uphill task for a beginner, since it involves -several steps, writing the firmware for the PRU, writing a loader -program. This can be a easy task for a experienced developer, but it -keeps many creative developers away. So, I propose to implement a easy -to understand language for the PRU, hiding away all the low level stuff -and providing a clean interface to program PRU. - -This can be achieved by implementing a language on top of PRU C. It will -directly compile down to PRU C. This could also be solved by -implementing a bytecode engine on the PRU, but this will result in waste -of already limited resources on PRU. With this approach, both PRU cores -can be run independent of each other. +These are the examples which have been tested on simpPRU.These examples will serve as a guide for the users to implement. + .. image:: images/simpPRU.png :width: 398 :align: center :height: 200 - :alt: simpPRU - - -What is simpPRU ---------------- - -- simpPRU is a procedural programming language. -- It is a statically typed language. Variables and functions must be - assigned data types during compilation. -- It is typesafe, and data types of variables are decided during - compilation. -- simPRU codes have a ``.sim`` extension. -- simpPRU provides a console app to use Remoteproc functionality. + :alt: simpPRU Examples .. toctree:: :maxdepth: 1 - build.rst - install.rst - language.rst - io.rst - usage-simppru.rst - usage-simppru-console.rst + delay.rst + digital_read.rst + digital_write.rst + hcsr04_example_rpmsg.rst + hcsr04_sensor.rst + button_click_rpmsg.rst + led_blink_button.rst + led_blink_for.rst + led_blink_while.rst + led_blink.rst + read_counter.rst + rpmsg_example.rst + rpmsg_pru_calculator.rst diff --git a/simppru-examples/led_blink.rst b/simppru-examples/led_blink.rst index 39fa662530dd6aec2f07e9f7c23d13a4dbcc9450..28f49776d6436afad17d1efdd76cc9c1c4858228 100644 --- a/simppru-examples/led_blink.rst +++ b/simppru-examples/led_blink.rst @@ -1,12 +1,11 @@ LED blink example ================= -!!! info “Schematic†=== “Pocket Beagle†|image0| - -:: - - === "BeagleBone Black / Beagle Bone Black Wireless" -  +.. image:: images/led_pocket_beagle.png + :width: 598 + :align: center + :height: 400 + :alt: LED blink example Code ---- @@ -31,4 +30,3 @@ This code runs a never ending loop, since it is ``while : true``. Inside header pin P1_31 to LOW, then again it waits for 1000ms. This loop runs endlessly, so we get a Blinking output if one connects a LED -.. |image0| image:: images/led_pocket_beagle.png diff --git a/simppru-examples/led_blink_button.rst b/simppru-examples/led_blink_button.rst index 45374e3445ea57745be316f3a926b6d9c219c424..915a813eb03f41b3fea488329b619a03467df827 100644 --- a/simppru-examples/led_blink_button.rst +++ b/simppru-examples/led_blink_button.rst @@ -1,12 +1,11 @@ LED blink on button press example ================================= -!!! info “Schematic†=== “Pocket Beagle†|image0| - -:: - - === "BeagleBone Black / Beagle Bone Black Wireless" -  +.. image:: images/led_button_pocket_beagle.png + :width: 598 + :align: center + :height: 400 + :alt: LED blink on button press example Code ---- @@ -34,5 +33,3 @@ HIGH, waits for 1000ms, then sets header pin P1_31 to LOW, then again it waits for 1000ms. This loop runs endlessly as long as header pin P1_29 is HIGH, so we get a Blinking output if one connects a LED to output pin. - -.. |image0| image:: images/led_button_pocket_beagle.png diff --git a/simppru-examples/led_blink_counter.rst b/simppru-examples/led_blink_counter.rst index a2641cf1a99942213e21fc767d90b8350d5ea010..3719694e21a3531b0b195ccd3dd52e8eec5e3e83 100644 --- a/simppru-examples/led_blink_counter.rst +++ b/simppru-examples/led_blink_counter.rst @@ -1,12 +1,11 @@ LED blink using hardware counter ================================ -!!! info “Schematic†=== “Pocket Beagle†|image0| - -:: - - === "BeagleBone Black / Beagle Bone Black Wireless" -  +.. image:: images/led_pocket_beagle.png + :width: 598 + :align: center + :height: 400 + :alt: LED blink using hardware counter Code ---- @@ -49,5 +48,3 @@ loop. Here, we check if ``read_counter`` is less than 200000000, as counter takes exactly 1 second to count this much cycles, so basically the LED is turned on for 1 second, and then turned off for 1 second. Thus if a LED is connected to the pin, we get a endlessly blinking LED. - -.. |image0| image:: images/led_pocket_beagle.png diff --git a/simppru-examples/led_blink_for.rst b/simppru-examples/led_blink_for.rst index dda15efb2620172a2f4e26fb9075c57fe487e1ef..18a774cb76f922fd886223f3ca71d5779a38aef4 100644 --- a/simppru-examples/led_blink_for.rst +++ b/simppru-examples/led_blink_for.rst @@ -1,14 +1,12 @@ LED blink using for loop example ================================ -!!! info “Schematic†=== “Pocket Beagle†|image0| - -:: - - === "BeagleBone Black / Beagle Bone Black Wireless" -  +.. image:: images/led_pocket_beagle.png + :width: 598 + :align: center + :height: 400 + :alt: LED blink using while loop example Code ---- @@ -31,4 +30,3 @@ Inside ``while`` it sets header pin P1_31 to HIGH, waits for 1000ms, then sets header pin P1_31 to LOW, then again it waits for 1000ms. This loop runs endlessly, so we get a Blinking output if one connects a LED -.. |image0| image:: images/led_pocket_beagle.png diff --git a/simppru/index.rst b/simppru/index.rst index fd36882a7c7c28203e5978b2d9831d8d5667c20e..d8e953f4e8a97e719c9e204477e7d8555bbe7c1e 100644 --- a/simppru/index.rst +++ b/simppru/index.rst @@ -37,7 +37,7 @@ What is simpPRU assigned data types during compilation. - It is typesafe, and data types of variables are decided during compilation. -- simPRU codes have a ``.sim`` extension. +- simpPRU codes have a ``.sim`` extension. - simpPRU provides a console app to use Remoteproc functionality. diff --git a/simppru/io.rst b/simppru/io.rst index 8b7e63e6bb07e6be75a6770509114966f14eeb52..fe2e84102b1ea9c1e043b0fdb5e52e7163db3a2d 100644 --- a/simppru/io.rst +++ b/simppru/io.rst @@ -1,158 +1,6 @@ IO Functions ============ -PRU<->Header pin mappings -------------------------- - -=== “PocketBeagle†=== “PRU0†\| R30 Register bit (Output) \| R31 -Register bit (Input) \| Header pin \| \| :————–: \| :————–: \| :——–: \| -\| - \| 16 \| P1_20 \| \| 7 \| 7 \| P1_29 \| \| 4 \| 4 \| P1_31 \| \| 1 -\| 1 \| P1_33 \| \| 0 \| 0 \| P1_36 \| \| - \| 15 \| P2_18 \| \| 15 \| - -\| P2_33 \| \| - \| 14 \| P2_22 \| \| 14 \| - \| P2_24 \| \| 6 \| 6 \| -P2_28 \| \| 3 \| 3 \| P2_30 \| \| 2 \| 2 \| P2_32 \| \| 5 \| 5 \| P2_34 -\| - -:: - - === "PRU1" - | R30 Register bit (Output) | R31 Register bit (Input) | Header pin | - | :--------------: | :--------------: | :--------: | - | 9 | 9 | P1_02 | - | 11 | 11 | P1_04 | - | 15 | 15 | P1_30 | - | 14 | 14 | P1_32 | - | 10 | 10 | P1_35 | - | - | 16 | P2_31 | - | 8 | 8 | P2_35 | - -=== “BeagleBone Black†=== “PRU0†\| R30 Register bit (Output) \| R31 -Register bit (Input) \| Header pin \| \| :————–: \| :————–: \| :——–: \| -\| - \| 15 \| P8_15 \| \| 15 \| - \| P8_11 \| \| - \| 14 \| P8_16 \| \| -14 \| - \| P8_12 \| \| 7 \| 7 \| P9_25 \| \| 5 \| 5 \| P9_27 \| \| 3 \| -3 \| P9_28 \| \| 1 \| 1 \| P9_29 \| \| 2 \| 2 \| P9_30 \| \| 0 \| 0 \| -P9_31 \| \| 6 \| 6 \| P9_41 \| \| 4 \| 4 \| P9_42 \| - -:: - - === "PRU1" - | R30 Register bit (Output) | R31 Register bit (Input) | Header pin | - | :--------------: | :--------------: | :--------: | - | 13 | 13 | P8_20 | - | 12 | 12 | P8_21 | - | 8 | 8 | **P8_27 | - | 10 | 10 | **P8_28 | - | 9 | 9 | **P8_29 | - | 6 | 6 | **P8_39 | - | 7 | 7 | **P8_40 | - | 4 | 4 | **P8_41 | - | 5 | 5 | **P8_42 | - | 2 | 2 | **P8_43 | - | 3 | 3 | **P8_44 | - | 0 | 0 | **P8_45 | - | 1 | 1 | **P8_46 | - - ** Before using these pins, you need to disable HDMI functionality. - You can read how to do this [here](https://archive.vn/D8Bzy) - -=== “BeagleBone Black Wireless†=== “PRU0†\| R30 Register bit (Output) -\| R31 Register bit (Input) \| Header pin \| \| :————–: \| :————–: \| -:——–: \| \| - \| 15 \| P8_15 \| \| 15 \| - \| P8_11 \| \| - \| 14 \| -P8_16 \| \| 14 \| - \| P8_12 \| \| 7 \| 7 \| P9_25 \| \| 5 \| 5 \| P9_27 -\| \| 3 \| 3 \| P9_28 \| \| 1 \| 1 \| P9_29 \| \| 2 \| 2 \| P9_30 \| \| -0 \| 0 \| P9_31 \| \| 6 \| 6 \| P9_41 \| \| 4 \| 4 \| P9_42 \| - -::/home/krishna/docs.beagleboard.io/simppru/usage/images - - === "PRU1" - | R30 Register bit (Output) | R31 Register bit (Input) | Header pin | - | :--------------: | :--------------: | :--------: | - | 13 | 13 | P8_20 | - | 12 | 12 | P8_21 | - | 8 | 8 | **P8_27 | - | 10 | 10 | **P8_28 | - | 9 | 9 | **P8_29 | - | 6 | 6 | **P8_39 | - | 7 | 7 | **P8_40 | - | 4 | 4 | **P8_41 | - | 5 | 5 | **P8_42 | - | 2 | 2 | **P8_43 | - | 3 | 3 | **P8_44 | - | 0 | 0 | **P8_45 | - | 1 | 1 | **P8_46 | - - ** Before using these pins, you need to disable HDMI functionality. - You can read how to do this [here](https://archive.vn/D8Bzy) - -=== “BeagleBone AI†=== “PRU0†\| R30 Register bit (Output) \| R31 -Register bit (Input) \| Header pin \| \| :————–: \| :————–: \| :——–: \| -\| 3 \| 3 \| P8_12 \| \| 4 \| 4 \| P8_11 \| \| 5 \| 5 \| P9_15 \| \| 17 -\| 17 \| P9_26 \| - -:: - - === "PRU1" - | R30 Register bit (Output) | R31 Register bit (Input) | Header pin | - | :--------------: | :--------------: | :--------: | - | 1 | 1 | P9_20 | - | 2 | 2 | P9_19 | - | 3 | 3 | P9_41 | - | 5 | 5 | P8_18 | - | 6 | 6 | P8_19 | - | 7 | 7 | P8_13 | - | 9 | 9 | P8_14 | - | 10 | 10 | P9_42 | - | 11 | 11 | P9_27 | - | 14 | 14 | P9_14 | - | 15 | 15 | P9_16 | - | 16 | 16 | P8_15 | - | 17 | 17 | P8_26 | - | 18 | 18 | P8_16 | - - === "PRU2" - | R30 Register bit (Output) | R31 Register bit (Input) | Header pin | - | :--------------: | :--------------: | :--------: | - | 10 | 10 | P8_33 | - | 11 | 11 | P8_31 | - | 6 | 6 | P8_38 | - | 7 | 7 | P8_36 | - | 20 | 20 | P8_08 | - | 15 | 15 | P9_13 | - | 3 | 3 | P8_39 | - | 2 | 2 | P8_42 | - | 9 | 9 | P8_35 | - | 8 | 8 | P8_34 | - | 5 | 5 | P8_37 | - | 4 | 4 | P8_40 | - | 17 | 17 | P8_28 | - | 18 | 18 | P8_29 | - | 19 | 19 | P8_30 | - | 1 | 1 | P8_41 | - | 0 | 0 | P8_44 | - | 14 | 14 | P9_11 | - - === "PRU3" - | R30 Register bit (Output) | R31 Register bit (Input) | Header pin | - | :--------------: | :--------------: | :--------: | - | 0 | 0 | P8_32 | - | 5 | 5 | P9_25 | - | 6 | 6 | P8_09 | - | 10 | 10 | P9_31 | - | 8 | 8 | P9_18 | - | 16 | 16 | P8_07 | - | 15 | 15 | P8_10 | - | 17 | 17 | P8_27 | - | 20 | 20 | P8_43 | - | 18 | 18 | P8_45 | - | 19 | 19 | P8_46 | - | 9 | 9 | P9_17 | - | 13 | 13 | P9_28 | - | 11 | 11 | P9_29 | - | 12 | 12 | P9_30 | - - ** Before using these pins, you need to disable HDMI functionality. - You can read how to do this [here](https://archive.vn/D8Bzy) - - - All Header pins are ``constant integer variable`` by default, with its value equal to respective R30/R31 register bit diff --git a/simppru/language.rst b/simppru/language.rst index ead310a468a5980b46968671dc9502df3b6e7ce1..0dc4895b786aa35e918d0ef952a7f11f0f5dcda8 100644 --- a/simppru/language.rst +++ b/simppru/language.rst @@ -14,8 +14,7 @@ Datatypes - ``int`` - Integer datatype - ``bool`` - Boolean datatype - ``char`` / ``uint8`` - Character / Unsigned 8 bit integer datatype -- ``void`` - Void datatype, can only be used a return type for - functions +- ``void`` - Void datatype, can only be used a return type for functions Constants --------- @@ -27,8 +26,7 @@ Constants - ``true`` - Boolean constant (True) - ``false`` - Boolean constant (False) - ``Px_yz`` - Pin mapping constants are Integer constant, where x is - 1,2 or 8,9 and yz are the header pin numbers. For further details - refer to `this <io.md>`__ + 1,2 or 8,9 and yz are the header pin numbers. Operators --------- @@ -81,8 +79,7 @@ Variable declaration ``boolean`` by default. - Variables can be assigned other variables of same datatype. ``int``\ s and ``char``\ s can be assigned to each other. -- Variables can be assigned expressions whose output is of same - datatype. +- Variables can be assigned expressions whose output is of same datatype. Declaration ~~~~~~~~~~~ @@ -147,8 +144,7 @@ Indexing: - Arrays are zero-indexed. -- The index can be either a char or an int or an expression involving - chars and ints. +- The index can be either a char or an int or an expression involving chars and ints. - Accessing elements of an array: @@ -269,8 +265,7 @@ Boolean expressions => 'a' < 'b'; true -!!! Note Expressions are evaluated following the `operator -precedence <#operators>`__ +- **Note** : Expressions are evaluated following the `operator precedence <#operators>` If-else statement ----------------- @@ -373,9 +368,7 @@ Syntax .... } -!!! Note **var** is a **integer**, and **start, stop, increment** can be -**arithmetic expression, integer or character variable, or integer or -character constant**. +- **Note** : **var** is a **integer**, and **start, stop, increment** can be **arithmetic expression, integer or character variable, or integer or character constant**. .. _examples-1: @@ -410,8 +403,7 @@ Examples While-loop statement -------------------- -While loop statement repeatedly executes a target statement as long as a -given condition is true. +While loop statement repeatedly executes a target statement as long as a given condition is true. .. _syntax-2: @@ -453,8 +445,7 @@ Examples Control statements ------------------ -!!! Note ``break`` and ``continue`` can only be used inside looping -statements +- **Note** : ``break`` and ``continue`` can only be used inside looping statements break ~~~~~ @@ -525,7 +516,7 @@ declaration tells the compiler about a function’s name, return type, and parameters. A function definition provides the actual body of the function. -!!! warning Function must be defined before calling it. +- **Warning** : Function must be defined before calling it. .. _syntax-5: @@ -542,27 +533,36 @@ Syntax return <data_type>; } -!!! Note If return data type is void, then return statement is not +- **Note** : If return data type is void, then return statement is not needed, and if still it is added, it must be return nothing, i.e., something like this ``return ;`` -!!! Warning ``return`` can only be present in the body of the function +- **Warning** : ``return`` can only be present in the body of the function only once, that too at the end of the function, not inside any compound statements. -!!! fail “Wrong†\* ``return`` inside a compound statement, this syntax -is not allowed. -``python def test : int : int a { if : a < 4 { return a; } }`` +- **Wrong** : ``return`` inside a compound statement, this syntax is not allowed. -!!! done “Correct†\* ``return`` is not inside compound statments, It -should be placed only at the end of function definition \```python def -test : int : int a { int gf := 8; if : a < 4 { gf := 4; } +.. code:: python + + def test : int : int a { + if : a < 4 { + return a; + } + } -:: +- **Correct** : ``return`` is not inside compound statments, It should be placed only at the end of function definition - return gf; +.. code:: python + + def test : int : int a { + int gf := 8; + if : a < 4 + { + gf := 4; + } + return gf; } - ``` .. _examples-5: @@ -571,52 +571,52 @@ Examples Examples according to return types -=== “Integer†\```python def test_func : int : int a, int b { int aa := -a + 5; +- **Integer** -:: +.. code:: python - if : aa < 3 { + def test_func : int : int a, int b + { + int aa := a + 5; + if : aa < 3 { aa : = 0; - } + } - return aa + b; + return aa + b; } - ``` -=== “Character†\```python def next_char : char : char ch, int inc { -char chinc := ch + inc; +- **Character** -:: +.. code:: python - return chinc; + def next_char : char : char ch, int inc { + char chinc := ch + inc; + return chinc; } - ``` -=== “Boolean†\```python def compare : bool : int val { bool ret := -false; -:: +- **Boolean** - if : val < 0 { - ret := true; - } +.. code:: python - return ret; - } - ``` + def compare : bool : int val { + bool ret :=false; + if : val < 0 { + ret := true; + } + return ret; + } + -=== “Void†\```python def example_func : void : bool qu { if : qu and -true { … do something … } } +- **Void** -:: +.. code:: python def example_func_v : void : { int temp := 90; return; } - ``` Function call ~~~~~~~~~~~~~ @@ -639,24 +639,19 @@ Syntax Examples ^^^^^^^^ -We will consider functions defined in earlier -`subsection <#examples_5>`__ - -=== “Integer†-``python int a := 55; int ret_val := test_func(4, a);`` +- **Integer** ``int a := 55; int ret_val := test_func(4, a);`` -=== “Character†-``python char a := 'a'; char b := next_char(a, 1);`` +- **Character** ``char a := 'a'; char b := next_char(a, 1);`` -=== “Boolean†``python bool val := compare(22); compare(-2);`` +- **Boolean** ``bool val := compare(22); compare(-2);`` -=== “Void†``python example_func(false); example_func_v();`` +- **Void** ``example_func(false); example_func_v();`` Testing or Debugging ~~~~~~~~~~~~~~~~~~~~ -For testing or debugging code, use the –test or -t flag to enable print, -println and stub functions. Use –preprocess to stop after generating the +For testing or debugging code, use the --test or -t flag to enable print, +println and stub functions. Use --preprocess to stop after generating the C code only. Then run the generated C code (at /tmp/temp.c) using ``gcc``. @@ -683,4 +678,4 @@ Stub functions ^^^^^^^^^^^^^^ PRU specific functions will be replaced by stub functions which print -“function_name called with arguments arg_name†when called. +**function_name called with arguments arg_name** when called. diff --git a/simppru/usage-simppru-console.rst b/simppru/usage-simppru-console.rst index 22f72965d63ba9dd5b97eac079e8bb3e90029c2d..9099c88078f2e64fbe1399e5e3736a939ba5b995 100644 --- a/simppru/usage-simppru-console.rst +++ b/simppru/usage-simppru-console.rst @@ -1,4 +1,4 @@ -Usage +Usage(simppru-console) ===== simppru-console is a console app, it can be used to send/receive message @@ -6,10 +6,13 @@ to the PRU using RPMSG, and also start/stop the PRU. It is built to facilitate easier way to use rpmsg and remoteproc API's to control and communicate with the PRU -!!! Warning Make sure to stop PRU before exiting. Press ``ctrl+c`` to -exit +- **Warning** : Make sure to stop PRU before exiting. Press ``ctrl+c`` to exit -|image0| +.. image:: images/main_screen.png + :width: 598 + :align: center + :height: 400 + :alt: Main Screen Features -------- @@ -22,7 +25,11 @@ Start/stop buttons Use these button to start/stop the selected PRU. If PRU is already running, on starting simppru-console, it is automatically stopped. -|image1| +.. image:: images/stop_screen.png + :width: 598 + :align: center + :height: 400 + :alt: Start/stop buttons Send message to PRU ~~~~~~~~~~~~~~~~~~~ @@ -32,7 +39,11 @@ supported. On pressing enter, the typed message is sent. PRU0 is running echo program, whatever is sent is echoed back. -|image2| +.. image:: images/send_screen.png + :width: 598 + :align: center + :height: 400 + :alt: Start/stop buttons Receive message from PRU ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -42,26 +53,30 @@ using a for loop, which checks if new message is arrived every 10 ms. - PRU is running echo program, whatever is sent is echoed back. - |image3| |image4| +.. image:: images/receive_screen_2.png + :width: 598 + :align: center + :height: 400 + :alt: Echoing program - PRU is running countup program, it sends a increasing count every 1 second, which starts from 0 - |image5| |image6| +.. image:: images/receive_counter_2.png + :width: 598 + :align: center + :height: 400 + :alt: Echoing program -Change PRU id +Change PRU ID ~~~~~~~~~~~~~ Using the radio box in the upper right corner, one can change the PRU id, i.e. if one wants to use the features for PRU0 or PRU1 -|image7| +.. image:: images/select_pru_id_screen.png + :width: 598 + :align: center + :height: 400 + :alt: Change the PRU ID -.. |image0| image:: images/main_screen.png -.. |image1| image:: images/stop_screen.png -.. |image2| image:: images/send_screen.png -.. |image3| image:: images/receive_screen.png -.. |image4| image:: images/receive_screen_2.png -.. |image5| image:: images/receive_counter.png -.. |image6| image:: images/receive_counter_2.png -.. |image7| image:: images/select_pru_id_screen.png diff --git a/simppru/usage-simppru.rst b/simppru/usage-simppru.rst index f9ca57cad364742390dad060631ede19a0e310c0..0d8fcf183b8c6cc53407e688da66a1c91e0227c4 100644 --- a/simppru/usage-simppru.rst +++ b/simppru/usage-simppru.rst @@ -1,4 +1,4 @@ -Usage +Usage(simppru) ===== .. code:: bash