Deep Dive w/Scott: Guest @jim_mussared #adafruit

Subscribers:
458,000
Published on ● Video Link: https://www.youtube.com/watch?v=bciRImf0_Ts



Counter-Strike: Source
Category:
Discussion
Duration: 2:08:41
1,157 views
34


Join Scott and guest @jim_mussared (@jimmo on GitHub) as they talk about MicroPython and debugging the native emitter.

Scott is sponsored by Adafruit to work on CircuitPython. Support them, and by extension Scott, by purchasing hardware from https://adafruit.com

Jim is sponsored by George Robotics to work on MicroPython. Sponsor them on GitHub: https://github.com/sponsors/micropython See https://github.com/micropython/micropython and http://micropython.org/ for more information about MicroPython.

Chat with Scott, Jim and lot of others on the Adafruit Discord at https://adafru.it/discord.

Deep Dive happens every week. Normally Fridays at 2pm Pacific but occasionally shifted to Thursday at 2pm. Typically goes for two hours or more. Questions are welcome. Next week should be on Friday.

Links:
* https://github.com/jimmo
* https://github.com/micropython/micropython/issues/7523
* https://devblogs.microsoft.com/oldnewthing/20210531-00/?p=105265
* https://github.com/sponsors/micropython
* https://store.micropython.org/

Thanks to @dcd for timecodes.

0:00 Getting started after technical issues

0:03:43 Welcome Jim @jim_mussared
0:07:44 Black box with blinky lights on the wall
0:08:50 http://megaprocessor.com/
0:12:00 - black screen - ( obs transition / rearrange screen)
0:15:16 Jim’s desktop
0:17:00 @micropython.native decorator - compile to native thumb code in RAM
0:20:00 freezing code moves it to flash
0:21:55 import mic0ropython discussion - to catch code not portable to cpython
0:23:00 const variables, and _ prefixed variables
0:25:23 thumb code ( ARM and thumb ( native cortex machine code ) )
0:26:55 ISA - (RISC-V api )
0:30:20 instruction lookahead - deep pipelining
0:31:15 Spectre / speculative look ahead / security issues
0:32:25 Jim’s secret agenda for the deep dive - native emitter for RISC-V (esp32)
0:34:20 CP needs BLE if not native USB
0:35:35 micropython.native code incorrect execution
0:36:10 mpr - micropython remote “mpr run”
0:36:50 mpr mount - access to remote REPL
0:37:40 CP-like workflow over serial (esp32)
0:38:35 @micropython.viper - optimization by skipping the python object overhead
0:40:10 MP type hints - normally ignored
0:40:45 type hints as IDE help
0:41:20 If you have repeating numbers like your 255s and 0s, is it a bad idea to make them consts? Are they already treated like consts internally?
0:43:44 disassemble (alias blaze = ‘make -j 16’ / on linux port )
0:47:00 microcpython -v -v -v to disassemble to micropython VM bytecode - walk through the byte code
0:51:15 - 3 stacks to discuss later
0:53:30 mp binary op internals
0:55:40 what is an emitter - lexical analysis , parse into tree, emit code from parse tree ( byte code, emit native code, or emit viper code )
0:57:50 byte code emitter emitbc.c
0:58:59 compile.c calls emitter, or emitnative.c
1:01:30 Is .native and .viper just at a method level? Class level too?
1:02:50 native ‘everything’ by saving the python to a code
1:08:00 continue in emit native
1:10:10 what if we use a local variable?
1:11:34 gdb ./micropython ( oops - rebuild first )
1:13:35 mp_obj_t ( the most useful point of this deep dive )
1:15:20 type tagging ( see mpconfig.h )
1:16:45 some builds of CP don’t support long integers
1:18:35 . is there anything else than micropython that emit micropython bytecode? Like at one point everyone was making JVM bytecode even not being java
1:20:05 everything is a 32 bit integer - ( or a pointer to an object )
1:21:10 Why (3) is really 1 and 0x1ff
1:22:25 gdb backtrace doesn’t work with native emitter
1:23:10 anybody doing "hand written" bytecode to do something smart or super optimised?
1:25:00 Write part of the core in the python
1:27:55 looking at the native code generated in a file
1:29:49 Is there a byte code to python "decompiler"?
1:30:30 debug the debugging code
1:32:03 objdump to disassemble the generated code (x86-64 code)
1:34:50 rbp is pointer to func table - ( there is no linker)
1:41:03 viper generation
1:45:40 emit_native_jump_helper
1:47:08 3 different stacks ( processor, MP function stack, emitter stack (while emitting )
1:49:00 optimization
1:51:50 - another optimization - keep variables in registers
1:53:50 - clobber EAX
1:55:40 RISC-V ISA/calling conventions ( ABI - binary interface )
1:57:30 one character fix ( use EDI instead of EAX )
1:58:52 Write a test to verify the fix
1:59:45 fixed on thumb code
2:00:00 MP issue https://github.com/micropython/micropython/issues/7523
Thanks to Jim and https://store.micropython.org/
2:08:00 wrap up!
2:08:30 - final frame :-)

-----------------------------------------
LIVE CHAT IS HERE! http://adafru.it/discord

Adafruit on Instagram: https://www.instagram.com/adafruit

Subscribe to Adafruit on YouTube: http://adafru.it/subscribe

New tutorials on the Adafruit Learning System: http://learn.adafruit.com/
-----------------------------------------




Other Videos By Adafruit Industries


2021-07-213D Hangouts – Braille Keycaps, Emoji Keypad and Alligator Loki
2021-07-20MacroPad Braille Keycaps #3DPrinting #Adafruit
2021-07-20JP's Product Pick of the Week Music Maker FeatherWing @adafruit @johnedgarpark #adafruit
2021-07-20Digital Tweezers - Collin’s Lab Notes #adafruit #collinslabnotes
2021-07-20JP’s Product Pick of the Week 7/20/21 Music Maker FeatherWing @adafruit @johnedgarpark #adafruit
2021-07-19Alligator Loki #adafruit
2021-07-19Electret Mic Teardown - Collin’s Lab Notes #adafruit #collinslabnotes
2021-07-19CircuitPython Weekly for July 19th, 2021 @circuitpython #adafruit
2021-07-18The Great Search - 24V Quiet Hot End Fan (3D Printer Replacement)
2021-07-16John Park's CircuitPython Parsec: Mod Operator @adafruit @johnedgarpark #adafruit
2021-07-16Deep Dive w/Scott: Guest @jim_mussared #adafruit
2021-07-15New Products 7/15/21 feat. NeoKey 5x6 Ortho Snap-Apart Mechanical Key Switches w/ NeoPixel!
2021-07-15JOHN PARK'S WORKSHOP LIVE 7/5/21 Macropad MIDI Tester @adafruit @johnedgarpark #adafruit
2021-07-15EYE ON NPI - Stewart IP67 Rated USB Type-A Cable Assemblies #EYEonNPI @DigiKey @Adafruit @BelFuseInc
2021-07-15Adafruit Top Secret! July 14 2021 #Adafruit #AdafruitTopSecret @Adafruit
2021-07-15Python on Hardware weekly video 141 #CircuitPython #Python #MicroPython @Adafruit
2021-07-15Made in NYC 7/14/2021 Featuring NeoKey Tests and MacroPad Boxes
2021-07-14Capacitor Types P2: Tantalum & Film - Collin’s Lab Notes #adafruit #collinslabnotes
2021-07-14ASK AN ENGINEER 7/14/2021 LIVE!
2021-07-14SHOW and TELL 7/14/2021 #ShowandTell
2021-07-14Macropad MIDI Tester demo @adafruit @johnedgarpark #adafruit



Tags:
adafruit
electronics
diy
arduino
hardware
opensource
projects
raspberry
pi
computer
raspberrypi
microcontrollers
limor
limorfried
ladyada
STEAM
STEM
python
microbit
circuitpython
neopixel
neopixels
raspberry pi
circuitplaygound
nyc
make
makers
micro:bit
adafrit
adafruit promo code
ada fruit
adafruit coupons
raspberry pi zero
micropython
machine learning
ai
tensorflow



Other Statistics

Counter-Strike: Source Statistics For Adafruit Industries

Adafruit Industries presently has 14,378 views for Counter-Strike: Source across 11 videos, and about 7 hours worth of Counter-Strike: Source videos were uploaded to his channel. This is less than 0.22% of the total video content that Adafruit Industries has uploaded to YouTube.