diff options
author | Raghuram Subramani <raghus2247@gmail.com> | 2022-06-21 16:54:16 +0530 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2022-06-21 16:54:16 +0530 |
commit | 2423eadd0b6fd0eb4d92c8ddd0f605a6b1075b09 (patch) | |
tree | 1544be2201b285f553f8ee18a613adcfd709c32e | |
parent | 4fd287655a72b9aea14cdac715ad5b90ed082ed2 (diff) |
some progressV1.0
-rw-r--r-- | .vscode/settings.json | 4 | ||||
-rw-r--r-- | .vscode/targets.log | 57 | ||||
-rw-r--r-- | circuitpython/Dockerfile | 2 | ||||
-rwxr-xr-x | circuitpython/build.sh | 2 | ||||
-rw-r--r-- | circuitpython/supervisor/shared/filesystem.c | 2 | ||||
-rw-r--r-- | converter.py (renamed from circuitpython/frozen/compromyse/compromyse.py) | 0 | ||||
-rw-r--r-- | firmware.uf2 (renamed from circuitpython/firmware.uf2) | bin | 1532928 -> 1532928 bytes | |||
-rw-r--r-- | generated/code.py | 1 | ||||
-rw-r--r-- | picoducky.py | 63 | ||||
-rw-r--r-- | requirements.txt | 1 |
10 files changed, 92 insertions, 40 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json index 65e1ec0..611f314 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,5 @@ { - "makefile.extensionOutputFolder": "./.vscode" + "makefile.extensionOutputFolder": "./.vscode", + "cmake.configureOnOpen": false, + "rpc.enabled": true }
\ No newline at end of file diff --git a/.vscode/targets.log b/.vscode/targets.log index d0aa1e5..394c7ea 100644 --- a/.vscode/targets.log +++ b/.vscode/targets.log @@ -6,7 +6,7 @@ make all --print-data-base --no-builtin-variables --no-builtin-rules --question # This is free software: you are free to change and redistribute it. # There is NO WARRANTY, to the extent permitted by law. -# Make data base, printed on Sun Jun 19 19:47:22 2022 +# Make data base, printed on Tue Jun 21 16:37:07 2022 # Variables @@ -15,15 +15,11 @@ GDK_BACKEND = x11 # environment LC_ALL = C # environment -TERMINATOR_DBUS_NAME = net.tenshu.Terminator21a9d5db22c73a993ff0b42f64b396873 -# environment -VSCODE_IPC_HOOK_EXTHOST = /run/user/1000/vscode-ipc-2095660f-b987-4477-bc0d-99b67b9e69ab.sock +VSCODE_IPC_HOOK_EXTHOST = /run/user/1000/vscode-ipc-4d3f2e6e-38bd-449b-8845-cfd127c0e46e.sock # environment MANDATORY_PATH = /usr/share/gconf/xubuntu.mandatory.path # environment -VSCODE_CWD = /home/raghu/data/laboratory/picoDucky -# environment -TERMINATOR_UUID = urn:uuid:24ba4af5-61b6-4c81-afef-54e21966f8f5 +VSCODE_CWD = /home/raghu # environment LIBVIRT_DEFAULT_URI = qemu:///system # environment @@ -43,9 +39,7 @@ PWD = /home/raghu/data/laboratory/picoDucky # automatic %D = $(patsubst %/,%,$(dir $%)) # environment -XDG_DATA_DIRS = /usr/share/xubuntu:/usr/share/xfce4:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/usr/share -# environment -OLDPWD = /home/raghu/data/laboratory +XDG_DATA_DIRS = /home/raghu/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/share/xubuntu:/usr/share/xfce4:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/usr/share # automatic ^D = $(patsubst %/,%,$(dir $^)) # environment @@ -66,8 +60,6 @@ XAUTHORITY = /home/raghu/.Xauthority .INCLUDE_DIRS = /usr/local/include /usr/include /usr/include # makefile MAKEFLAGS = pqrR -# environment -TERMINATOR_DBUS_PATH = /net/tenshu/Terminator2 # makefile CURDIR := /home/raghu/data/laboratory/picoDucky # environment @@ -97,7 +89,7 @@ MAKEFILE_LIST := # environment VSCODE_VERBOSE_LOGGING = true # environment -VSCODE_PID = 396120 +VSCODE_PID = 481696 # environment XDG_SESSION_TYPE = x11 # automatic @@ -125,13 +117,13 @@ SHELL = /bin/sh # default MAKECMDGOALS := all # environment -SHLVL = 1 +SHLVL = 0 # environment MAKELEVEL := 0 # default MAKE = $(MAKE_COMMAND) # environment -PATH = /home/raghu/gems/bin:/home/raghu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin +PATH = /home/raghu/.local/bin:/home/raghu/gems/bin:/home/raghu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin # default MAKEFILES := # environment @@ -149,7 +141,7 @@ XDG_SEAT = seat0 # environment XDG_CURRENT_DESKTOP = XFCE # environment -LS_COLORS = rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: +LS_COLORS = # automatic +F = $(notdir $+) # environment @@ -175,7 +167,7 @@ DEFAULTS_PATH = /usr/share/gconf/xubuntu.default.path # default MAKE_VERSION := 4.3 # environment -_ = /usr/bin/code +_ = /usr/share/code/code # environment XDG_RUNTIME_DIR = /run/user/1000 # environment @@ -183,8 +175,6 @@ GEM_HOME = /home/raghu/gems # environment GPG_AGENT_INFO = /run/user/1000/gnupg/S.gpg-agent:0:1 # environment -COLORTERM = truecolor -# environment GTK_OVERLAY_SCROLLING = 0 # environment XDG_SESSION_CLASS = user @@ -197,9 +187,9 @@ ELECTRON_RUN_AS_NODE = 1 # environment VSCODE_IPC_HOOK = /run/user/1000/vscode-023e123c-1.68.1-main.sock # environment -TERM = xterm-256color -# environment XDG_SESSION_ID = c2 +# environment +PANEL_GDK_CORE_DEVICE_EVENTS = 0 # default .RECIPEPREFIX := # automatic @@ -207,12 +197,6 @@ XDG_SESSION_ID = c2 # default SUFFIXES := # environment -VSCODE_CLI = 1 -# environment -ELECTRON_NO_ATTACH_CONSOLE = 1 -# environment -VTE_VERSION = 6800 -# environment XDG_GREETER_DATA_DIR = /var/lib/lightdm-data/raghu # default .FEATURES := target-specific order-only second-expansion else-if shortest-stem undefine oneshell nocomment grouped-target extra-prereqs archives jobserver output-sync check-symlink load @@ -221,7 +205,7 @@ XDG_MENU_PREFIX = xfce- # environment GDMSESSION = xubuntu # variable set hash-table stats: -# Load=105/1024=10%, Rehash=0, Collisions=6/132=5% +# Load=97/1024=9%, Rehash=0, Collisions=5/124=4% # Pattern-specific Variable Values @@ -229,9 +213,9 @@ GDMSESSION = xubuntu # Directories -# . (device 2049, inode 6816481): 7 files, no impossibilities. +# . (device 2049, inode 6816481): 10 files, no impossibilities. -# 7 files, no impossibilities in 1 directories. +# 10 files, no impossibilities in 1 directories. # Implicit Rules @@ -281,15 +265,14 @@ GNUmakefile: # No general ('VPATH' variable) search path. -# strcache buffers: 1 (0) / strings = 15 / storage = 135 B / avg = 9 B -# current buf: size = 8162 B / used = 135 B / count = 15 / avg = 9 B +# strcache buffers: 1 (0) / strings = 18 / storage = 175 B / avg = 9 B +# current buf: size = 8162 B / used = 175 B / count = 18 / avg = 9 B -# strcache performance: lookups = 18 / hit rate = 16% +# strcache performance: lookups = 21 / hit rate = 14% # hash-table stats: +# Load=18/8192=0%, Rehash=0, Collisions=0/21=0% +# Finished Make data base on Tue Jun 21 16:37:07 2022 + make: *** No rule to make target 'all'. Stop. -# Load=15/8192=0%, Rehash=0, Collisions=0/18=0% -# Finished Make data base on Sun Jun 19 19:47:22 2022 - - diff --git a/circuitpython/Dockerfile b/circuitpython/Dockerfile index 496706a..127a3db 100644 --- a/circuitpython/Dockerfile +++ b/circuitpython/Dockerfile @@ -8,4 +8,4 @@ RUN apt-get install python3 python3-pip git gettext build-essential mtools gcc-a RUN pip3 install --upgrade -r requirements-dev.txt RUN make -C mpy-cross -# ENTRYPOINT ["bash", "build.sh"] +ENTRYPOINT [ "./build.sh" ]
\ No newline at end of file diff --git a/circuitpython/build.sh b/circuitpython/build.sh index 46908ae..c303149 100755 --- a/circuitpython/build.sh +++ b/circuitpython/build.sh @@ -1,6 +1,8 @@ #!/bin/bash a=$PWD +cp /mounted/code.py $a/frozen/compromyse/picoducky.py + cd $a/ports/raspberrypi/ make BOARD=raspberry_pi_pico -j4 diff --git a/circuitpython/supervisor/shared/filesystem.c b/circuitpython/supervisor/shared/filesystem.c index 820dbe9..5a22a4b 100644 --- a/circuitpython/supervisor/shared/filesystem.c +++ b/circuitpython/supervisor/shared/filesystem.c @@ -74,7 +74,7 @@ static void make_sample_code_file(FATFS *fatfs) { #if CIRCUITPY_FULL_BUILD FIL fs; UINT char_written = 0; - const byte buffer[] = "print(\"Hello World!\")\n"; + const byte buffer[] = "import picoducky\nmain()\n"; // Create or modify existing code.py file f_open(fatfs, &fs, "/code.py", FA_WRITE | FA_CREATE_ALWAYS); f_write(&fs, buffer, sizeof(buffer) - 1, &char_written); diff --git a/circuitpython/frozen/compromyse/compromyse.py b/converter.py index e69de29..e69de29 100644 --- a/circuitpython/frozen/compromyse/compromyse.py +++ b/converter.py diff --git a/circuitpython/firmware.uf2 b/firmware.uf2 Binary files differindex 502ed1d..a17a185 100644 --- a/circuitpython/firmware.uf2 +++ b/firmware.uf2 diff --git a/generated/code.py b/generated/code.py new file mode 100644 index 0000000..34b6ad8 --- /dev/null +++ b/generated/code.py @@ -0,0 +1 @@ +print('WORKED!!')
\ No newline at end of file diff --git a/picoducky.py b/picoducky.py new file mode 100644 index 0000000..a82ece0 --- /dev/null +++ b/picoducky.py @@ -0,0 +1,63 @@ +import os +import subprocess +from shutil import which +from termcolor import colored +import sys + +# Dependancy check +def depcheck(): + checklist = {} + # Returns None if docker is not present + checklist['docker'] = which('docker') + checklist['circuitpython'] = os.path.isdir('circuitpython') + return checklist + +# Build image +def buildimage(): + # Get ready to build + os.chdir('circuitpython') + # Build the image + print(colored('[+]> Building image, this may take a few minutes..', 'green')) + subprocess.call('docker build -t picoducky .', shell=True) + print("Done!") + +# Check if image already exists +def imagecheck(): + if subprocess.check_output('docker images -q picoducky 2> /dev/null', shell=True): + return True + else: + return False + +def main(): + dockerpresent = depcheck()['docker'] + circuitpythonpresent = depcheck()['circuitpython'] + + # Check if docker is present + if dockerpresent: + print(colored('[+]> Docker is present, script can continue..', 'green')) + else: + print(colored('[!]> Please make sure Docker is installed and is in your PATH.', 'red')) + + # Build image, skip build if image is already built + if imagecheck(): + print(colored("[+]> Looks like the Docker image is already built, I will skip that step.", 'green')) + else: + if circuitpythonpresent: + print(colored('[+]> Circuitpython directory is present, build can continue.', 'green')) + else: + print(colored('[-]> Circuitpython directory is absent, build cannot continue. Exitting...', 'red')) + sys.exit(1) + buildimage() + + # Run container and start build + subprocess.call("docker rm picoduckyrun >/dev/null 2>/dev/null", shell=True) + + print(colored('[+]> Everything went fine, starting firmware build..', 'green')) + subprocess.call('docker run --name picoduckyrun --mount type=bind,source="$(pwd)/generated",dst="/mounted" picoducky', shell=True) + + # Copy UF2 file + print(colored('Looks like the build succeeded, copying the file here...','green')) + subprocess.call("docker cp picoduckyrun:/circuitpython/firmware.uf2 firmware.uf2", shell=True) + +if __name__ == "__main__": + main()
\ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9ae6773 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +termcolor
\ No newline at end of file |