diff --git a/tests/Rpi4/Makefile b/tests/Rpi4/Makefile index d99e0ff..612a712 100755 --- a/tests/Rpi4/Makefile +++ b/tests/Rpi4/Makefile @@ -2,6 +2,9 @@ DEVICE:= +default: + /bin/bash build_Rpi4_owrt.sh + install_docker: bash install_docker.sh diff --git a/tests/Rpi4/README.md b/tests/Rpi4/README.md index 187d47a..903cfb0 100644 --- a/tests/Rpi4/README.md +++ b/tests/Rpi4/README.md @@ -9,7 +9,7 @@ Debugging hardware will be more laborious than debugging PC application. # Build Rpi4 image + `make build_docker` to build docker + `make docker` to enter docker container -+ `./build_Rpi4_owrt.sh` inside docker to automatically build image for Rpi4. Wait for 1 or 2 hours, depends on your internet speed and PC specs ++ `make` inside docker to automatically build image for Rpi4. Wait for 1 or 2 hours, depends on your internet speed and PC specs + Final image will be: openwrt-bcm27xx-bcm2711-rpi-4-squashfs-factory.img # Flash image to your microSD card Please read this carefully before deployment diff --git a/tests/Rpi4/build_Rpi4_owrt.sh b/tests/Rpi4/build_Rpi4_owrt.sh index 811e0ab..ba3624b 100755 --- a/tests/Rpi4/build_Rpi4_owrt.sh +++ b/tests/Rpi4/build_Rpi4_owrt.sh @@ -16,7 +16,8 @@ git config --global http.maxRequestBuffer 100M git config --global http.version HTTP/1.1 git config --global http.maxRequests 100 git config --global core.compression 0 - +git config --global --unset http.proxy +git config --global --unset https.proxy # Define variables TOPDIR=$PWD OPENWRT_DIR="$PWD/openwrt" diff --git a/tests/Rpi4/patches/config.txt b/tests/Rpi4/patches/config.txt new file mode 100644 index 0000000..8ecced3 --- /dev/null +++ b/tests/Rpi4/patches/config.txt @@ -0,0 +1,26 @@ +################################################################################ +# Bootloader configuration - config.txt +################################################################################ + +################################################################################ +# For overclocking and various other settings, see: +# https://www.raspberrypi.com/documentation/computers/config_txt.html +################################################################################ + +# OpenWrt config +include distroconfig.txt + +[all] +# Place your custom settings here. +[all] +enable_jtag_gpio=1 +gpio=22-27=a4 + +[pi1] +gpio=4=a5 + +[pi2] +gpio=4=a5 + +[pi3] +gpio=4=a5 diff --git a/tests/recursive_test/include/advanced.h b/tests/recursive_test/include/advanced.h index b1b3020..5ea320f 100644 --- a/tests/recursive_test/include/advanced.h +++ b/tests/recursive_test/include/advanced.h @@ -5,17 +5,27 @@ #include #include #include +#include + struct childStruct { - int childId; - std::string childString; + int age; + std::string name; }; -struct structTetst +struct parentStruct { - int id; - std::string b; - childStruct child; + int age; + std::string name; + childStruct childArr[100]; +}; + +struct familyStruct +{ + parentStruct dad; + int numberOfNumber; + char familyName[50]; + parentStruct mom; }; int factorial(int n); diff --git a/tests/recursive_test/src/advanced.cpp b/tests/recursive_test/src/advanced.cpp index 90b332f..52780d2 100644 --- a/tests/recursive_test/src/advanced.cpp +++ b/tests/recursive_test/src/advanced.cpp @@ -46,15 +46,47 @@ * */ int factorial(int n) { - struct structTetst testStruct = {-2, "test", {-1, "childTest"}}; - testStruct.id ++; - testStruct.id ++; - testStruct.id ++; + struct familyStruct family = { + // DAD + { + 50, + "DAD_NAME", + { + {1, + "1st_child"}, + {2, + "2nd_child"}, + {3, + "3rd_child"}, + } + }, + 4, "FAMILY", + + // MOM + { + 45, + "MOM_NAME", + { + {'a', + "a_child"}, + {'b', + "b_child"}, + {'c', + "c_child"}, + } + + } + }; + family.numberOfNumber ++; + family.numberOfNumber ++; + family.numberOfNumber ++; int abc = 0; abc ++; abc *= 2; - testStruct.child.childId ++; - testStruct.child.childString = "childTest " + std::to_string(abc); + family.dad.childArr[0].age ++; + family.dad.childArr[1].name = "childTest " + std::to_string(abc); + family.mom.childArr[1].age ++; + family.mom.childArr[0].name = "childTest " + std::to_string(abc) + std::to_string(abc); if (n <= 1) return 1; return n * factorial(n - 1); } diff --git a/tests/recursive_test/src/main.cpp b/tests/recursive_test/src/main.cpp index dbb56c1..5bf363f 100644 --- a/tests/recursive_test/src/main.cpp +++ b/tests/recursive_test/src/main.cpp @@ -7,7 +7,36 @@ using namespace std; -struct structTetst globalStruct = {-2, "test", {-1, "childTest"}}; +struct familyStruct globalStruct = { + // DAD + { + 50, + "DAD_NAME", + { + {1, + "1st_child"}, + {2, + "2nd_child"}, + {3, + "3rd_child"}, + } + }, + 4, "FAMILY", + // MOM + { + 45, + "MOM_NAME", + { + {'a', + "a_child"}, + {'b', + "b_child"}, + {'c', + "c_child"}, + } + + } + }; /*** * * @@ -55,15 +84,15 @@ struct structTetst globalStruct = {-2, "test", {-1, "childTest"}}; * */ int main() { - globalStruct.id =0; + globalStruct.numberOfNumber =0; int a = 10, b = 3; pid_t pid = getpid(); std::cout << "Process ID: " << pid << std::endl; - while (globalStruct.id < 100) + while (globalStruct.numberOfNumber < 100) { - globalStruct.id++; - globalStruct.child.childId = globalStruct.id; - globalStruct.child.childString = "Child String " + std::to_string(globalStruct.id); + globalStruct.numberOfNumber++; + globalStruct.dad.age = globalStruct.numberOfNumber; + globalStruct.dad.name = "Dad String " + std::to_string(globalStruct.numberOfNumber); cout << "Basic Arithmetic:" << endl; cout << a << " + " << b << " = " << add(a, b) << endl; cout << a << " - " << b << " = " << subtract(a, b) << endl; @@ -73,7 +102,7 @@ int main() { cout << "\nAdvanced Math:" << endl; cout << "Factorial of 5 = " << factorial(5) << endl; cout << "Fibonacci of 7 = " << fibonacci(7) << endl; - globalStruct.child.childId ++; + globalStruct.dad.age ++; std::this_thread::sleep_for(std::chrono::seconds(2)); } return 0;