Deep Dive w/Scott: Guest episode artwork

EPISODE · Jul 16, 2021 · 2H 8M

Deep Dive w/Scott: Guest

from Adafruit Industries · host Adafruit Industries

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/ -----------------------------------------

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/ -----------------------------------------

NOW PLAYING

Deep Dive w/Scott: Guest

0:00 2:08:41

No transcript for this episode yet

We transcribe on demand. Request one and we'll notify you when it's ready — usually under 10 minutes.

API Intersection Stoplight Building a successful API requires more than just coding. It starts with collaborative design, focuses on creating a great developer experience, and ends with getting your company on board, maintaining consistency, and maximizing your API’s profitability.In the API Intersection, you’ll learn from experienced API practitioners who transformed their organizations, and get tangible advice to build quality APIs with collaborative API-first design.Jason Harmon brings over a decade of industry-recognized REST API experience to discuss topics around API design, governance, identity/auth versioning, and more.They’ll answer listener questions, and discuss best practices on API design (definition, modeling, grammar), Governance (multi-team design, reviewing new API’s), Platform Transformation (culture, internal education, versioning) and more.They’ll also chat with experienced API practitioners from a wide array of industries to draw out practical takeaways and insights you can use.H TV Podcast Industries Chris Jones, Derek O'Neill and John Harrison. TV Podcast Industries TV Podcast Industries is a podcast that provides discussions and reviews of various TV shows, including recent popular series like Alien Earth, The Sandman, The Last of Us, The Boys, and Daredevil Born Again. They also cover shows such as Ironheart, Star Trek: Picard, The Rings of Power, and many more, spanning both Marvel and DC universes, as well as other genres. Heart to Heart Podcast One on One / Next Level Studios In the Heart to Heart Podcast, we talk to some of our favorite & most interesting people in the entertainment industry so you can feel empowered and learn that even in the most challenging of industries, where there’s a will there’s a way.Whether you’re an actor, a writer, a casting director, a talent rep, or just someone interested in the behind the scene happenings of the entertainment industry, this podcast will have something for you. NOW, this isn’t just another How To podcast for actors. Plenty of those shows already exist. In Heart to Heart, every guest will share stories inspired by their sometimes winding path to success on their own terms. Revisionist History Pushkin Industries Revisionist History is Malcolm Gladwell's journey through the overlooked and the misunderstood. Every episode re-examines something from the past—an event, a person, an idea, even a song—and asks whether we got it right the first time. From Pushkin Industries. Because sometimes the past deserves a second chance.To get early access to ad-free episodes and extra content, subscribe to Pushkin+ in Apple Podcasts or at pushkin.fm/plus.iHeartMedia is the exclusive podcast partner of Pushkin Industries.

Frequently Asked Questions

How long is this episode of Adafruit Industries?

This episode is 2 hours and 8 minutes long.

When was this Adafruit Industries episode published?

This episode was published on July 16, 2021.

What is this episode about?

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...

Can I download this Adafruit Industries episode?

Yes, you can download this episode by clicking the download button on the episode player, or subscribe to the podcast in your preferred podcast app for automatic downloads.
URL copied to clipboard!