Micropython Presentation

Micropython Presentation

All rightsAllreserved – All All rights reserved – Copyright © 2016 by SPACEBEL Copyright2016 by© SPACEBEL Copyright © 2012 by SPACEBEL SPACEBEL by Copyright 2012 © ESTEC – TEC-SW Final Presentation Day Dec 11th 2018 Scope of the project MicroPython script All rightsAllreserved – Byte code MicroPython MicroPython VM by SPACEBEL Cross-Compiler 2018 Copyright© 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 2 Scope of the project MicroPython script Configuration Make Pre-processing All rightsAllreserved – Byte code MicroPython MicroPython VM by SPACEBEL Cross-Compiler 2018 Copyright© Qualification Test Suite Eclipse IDE MicroPython SDE 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 3 Scope of the project Satellite Database MicroPython OBCP Configuration Make Pre-processing All rightsAllreserved – MicroPython MicroPython VM by SPACEBEL Cross-Compiler 2018 TM/TC Copyright© OBCP Engine OBCP Byte code Flight Software Eclipse IDE 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 4 Why a (qualified) Virtual Machine ? ● On-Board Control Procedures (OBCP) o Flexible flight procedures o Prepared on ground and dynamically uploaded All rightsAllreserved – o Extend flight SW functionality / simplify ground procedures by SPACEBEL by SPACEBEL o Tight requirements on OBCP execution environment ! 2018 Copyright© ● Payload Control Software o High-level execution environment o Must provide access to minimum of HW I/O 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 5 Why MicroPython ? ● Python is cool ● MicroPython is available All rightsAllreserved o Optimised for time/space – o Python 3.4 o Open Source by SPACEBEL o C implementation 2018 o Ported on various microcontrollers Copyright© o George Robotics Ltd, http://micropython.org ● Prototype port for LEON2 o “Porting of MicroPython to LEON platforms” ESA project 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 6 MicroPython VM (qualified) features ● Python 3.4 ● Object-orientation All rightsAllreserved ● Exception handling – ● Math functions MicroPython VM by SPACEBEL ● list, dict, bytearray, … 2018 ● Built-in imports Copyright© Excluded: ● Lots of built-in functions ● External imports ● Extensibility ● Most standard modules ● … ● … 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 7 VM Time/Space optimisation Controlled memory usage: ● Dedicated buffer for Python stack ● Dedicated buffer for heap All rightsAllreserved ● Garbage collector – MicroPython VM ● Heap can be locked by SPACEBEL 2018 Copyright© 2 object representations impacting memory and heap usage: ● 32 bits (objects are 32 bits, but any float is allocated on heap) ● 64 bits NaN boxing (any object takes 64 bits) 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 8 MicroPython SDE features Object Make representation (RTEMS, Math lib, Configuration modules) (selected features) Import Expander All rightsAllreserved – Byte code MicroPython MicroPython VM by SPACEBEL Cross-Compiler 2018 OBCP binary Copyright© ISO checksum Eclipse IDE + PyDev plugin + Pylint 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 9 SDE Import Expander MicroPython MicroPython In addition: script script ● Can replace names with import their values All rightsAllreserved ● Without copying all names – MicroPython MicroPython script script by SPACEBEL Very useful for SRDB ! 2018 Copyright© import MicroPython MicroPython main script main script with Import Expander without native imports native imports 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 10 VM testing RTEMS 4.8 Edisoft/Gaisler 32 bits / 64 bits NaN boxing object representation libm/MLFS All rightsAllreserved LEON2 Emulator – (with/without instrumentation) MicroPython VM Tested on by SPACEBEL 2018 LEON2 Hardware (EUCLID FUMO) Copyright© Qualification Test Suite C Python tests MicroPython tests Spacebel tests • Automated tests • End-to-end testing • 624 MicroPython scripts 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 11 VM analyses Code coverage analysis: ● Cantata ● Removal of unused code (MicroPython VM macro configuration) ● Justification of remaining non-covered code All rightsAllreserved Continuous static code analysis: – ● Polyspace Bug Finder MicroPython VM by SPACEBEL 2018 Copyright© Call graph analysis: ● Identification of direct and indirect recursive calls ● Protection of C stack usage 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 12 VM (and related) issues Coding style: ● Remain compatible with master branch ● No applicable coding standard and no adaptation ! Floating Points: All rightsAllreserved ● NaN, -0.0 – ● Issues in libm by SPACEBEL by SPACEBEL MicroPython VM ● Issues in VM 2018 ● Issues in LEON emulators Copyright© ● Questions on IEEE FP standard RTEMS Edisoft: ● Absence of trap 0x83 (window flush) required for NLR VM SPRs: ● No raw trap handler registration (set_vector) ● 62 fixed ● 48 (minor) used as-is 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 13 VM (and related) issues 48 minor VM SPRs used « as is »: ● 27 « not implemented » issues Not implemented (examples): ● 21 « deviations » wrt C Python ● Exception raised in such case ● locals() ● array.array bytearray rightsAllreserved , semantics – MicroPython VM not complete (deletion, accessors) ● bytes, str semantics not complete (keywords) by SPACEBEL 2018 Deviations (examples): ● rsplit semantics not complete ● __init__ method not supported for all Copyright© ● float('.') --> 0.0 built-in types (Exception…) o Not allowed in CPython ● sum(['a','b','c'],'') --> 'abc‘ ● List/tuple/array/bytes/subscript slices with o Not allowed in Cpython step != 1 ● {:f}'.format(1234.) --> '1233.999999‘ o print('abcdefghi'[0:9:2]) ● 1.015625 == 1015625E-6 --> False o Precision of 1e-13 in MicroPython via str ● Deviations with multiple inheritance ● Deviations with garbage collection 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 14 OBCP Engine features ● New Flight SW component ● PUS 18 TM/TC interface All rightsAllreserved ● Additional MicroPython – module: obcp_engine MicroPython VM by SPACEBEL ● Control/monitoring of VM 2018 TM/TC Copyright© OBCP Engine ● Dynamic aspects (multi-tasking) Flight Software ● Fault containment ● Highly configurable 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 15 obcp_engine module import obcp_engine Step is observable (in HK) Possible to stop/suspend on a step obcp_engine.step(1) All rightsAllreserved obcp_id = obcp_engine.get_obcp_id() – OBCP id determined when loading by SPACEBEL by SPACEBEL obcp_engine.step(2) 2018 Returns OBET time_before = obcp_engine.get_time() as float Copyright© obcp_engine.sleep(5.0) « OS » task wait versus obcp_engine.wait_1hz_sync() synchro with HW signal time_after = obcp_engine.get_time() delay = time_after – time_before 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 16 obcp_engine module arg_buffer = bytearray(4) obcp_engine.read_obcp_arguments(arg_buffer) Arguments can be provided when OBCP is started or when it runs import sdb obcp_engine.write_db_parameter(sdb.DB_PARAM5,arg_buffer) All rightsAllreserved x = obcp_engine.read_db_parameter(sdb.DB_PARAM6) – mem_buf = bytearray(20) Data Bank access (using SRDB) by SPACEBEL by SPACEBEL obcp_engine.read_memory(sdb.MEM_EEPROM,0,mem_buf) 2018 obc_engine.write_memory(sdb.MEM_RAM,1024,mem_buf) Memory access Copyright© obcp_engine.send_tm(sdb.GROUND,128,2,mem_buf) obcp_engine.generate_event(sdb.NULL,sdb.EVT_EXAMPLE1) TM generation 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 17 obcp_engine module tc = bytearray(25) obcp_engine.format_tc(tc,sdb.HK,3,1,True,True) tc_id = obcp_engine.send_tc(tc) Separate functions to format and to send a TC acc = obcp_engine.check_tc_acceptance_acknowledge(tc_id) All rightsAllreserved compl = obcp_engine.check_tc_completion_acknowledge(tc_id) – tm = bytearray(40) TC checks (-1 returned if no ack) by SPACEBEL by SPACEBEL obcp_engine.subscribe_tm(sdb.HK,3,25,5) 2018 while obcp_engine.receive_message(tm) == 0: pass TM access through Copyright© # process tm here subscription (similar to obcp_engine.unsubscribe_tm() ground procedures) 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 18 OBCP states All rightsAllreserved – by SPACEBEL by SPACEBEL 2018 Copyright© ● High priority OBCP: 1 single VM (with queueing) ● Low priority OBCP: 10 available VM (without queue) 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 19 Dynamic aspects ● 1 VM == 1 RTEMS task ● VM tasks have lowest priority in Flight SW ● 1 VM task with « high priority » All rightsAllreserved ● 10 VM tasks with same « low priority » – o by SPACEBEL RTEMS time-slicing to share the available CPU 2018 Copyright© ● VM execution = 1 unique call ● VM control using « hook » mechanism o suspend/resume OBCP o stop/abort OBCP (with exception) o housekeeping (VM memory usage…) 11/12/2018 Qualification of MicroPython VM and OBCP Engine – Python in Space 20 Fault containment ● CPU usage cannot be limited ● Controlled access to Flight VM must run at lowest priority SW resources ● Data Bank ● Memory All rightsAllreserved – ● Python stack limited and checked ● by SPACEBEL Python heap limited and checked 2018 ● Lockable heap (no garbage collection) Copyright©

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    25 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us