[mbedmicro/pyOCD] RTOS task awareness (#242)

133 views
Skip to first unread message

Chris Reed

unread,
Jun 23, 2016, 11:35:04 AM6/23/16
to mbedmicro/pyOCD

This PR adds support for RTOS modules that provide thread information to GDB. Two RTOSes are currently supported: FreeRTOS, and my own Argon. As part of this change set, some refactoring was done.

There is a new DebugContext class that has methods for reading/writing memory and registers. DebugContexts can be stacked, allowing filtering of these accesses. The RTOS module creates DebugContext instances for each thread. This is then used to redirect register accesses to the thread's saved state (or live registers if the thread is the current one).

GdbServer now uses a façade class that wraps DebugContext to provide its gdb-specific data. With this change, the gdb-specific methods were removed from CortexM and Target.

RTOS modules implement a subclass of ThreadProvider. There is a table of RTOS modules similar to the targets list in ./targets/init.py. RTOSes are automatically discovered.


You can view, comment on, or merge this pull request online at:

  https://github.com/mbedmicro/pyOCD/pull/242

Commit Summary

  • New CoreSightTarget methods to add an AP and core.
  • Fixed a circular import with semihost.
  • Created DebugContext class in new pyOCD.debug submodule.
  • Refactored gdb server specific target methods into a façade class.
  • Starting to implement RTOS thread awareness.
  • Fixed bug in CoreSightTarget.add_core().
  • Basic thread listing working for Argon.
  • Implemented code to read saved thread state for Argon.
  • Continued work on RTOS support.
  • Target classes keep a running run count as a run token.
  • RTOS awareness improvements.
  • Fixed GDBServer thread awareness bugs.
  • Changed some RTOS info logs to debug logs.
  • Using xSchedulerRunning global to tell if FreeRTOS is running.
  • RTOS improvements.
  • Handling different configs of FreeRTOS.
  • Reusing thread objects for FreeRTOS and Argon, plus other changes.
  • Implemented M4F support for the FreeRTOS thread provider.
  • RTOS support improvements.
  • Handling transfer errors in FreeRTOS support.
  • Updating Argon thread state and priority each scan.

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Russ Butler

unread,
Jun 23, 2016, 12:18:59 PM6/23/16
to mbedmicro/pyOCD

@mbed-bot: TEST

Russ Butler

unread,
Jun 23, 2016, 12:22:21 PM6/23/16
to mbedmicro/pyOCD

So does this allow RTOS task awareness without any extra plugins to eclipse? If so that is awesome!

What is the easiest way to try out this change? Pull down the KSDK and build a FreeRTOS project?

mbed-bot

unread,
Jun 23, 2016, 12:50:46 PM6/23/16
to mbedmicro/pyOCD

Test: FAILURE

Summary:



------ Speed Test Performance ------
Target    Read Speed      Write Speed     

lpc1768   21.600528 KB/s  21.529569 KB/s  
nrf51     37.151929 KB/s  31.148288 KB/s  
k64f      46.694693 KB/s  31.976580 KB/s  
k22f      37.827415 KB/s  27.565090 KB/s  
nrf51     18.024204 KB/s  15.603807 KB/s  
kl25z     41.478483 KB/s  25.051986 KB/s  
lpc824    20.634757 KB/s  16.752553 KB/s  
lpc11xx_3222.505504 KB/s  18.875575 KB/s  



------ Analyzer Performance ------
Target    Analyzer    Rate              Time              

lpc1768   CRC32       1236.528925 KB/s  0.0529999732971 s 
nrf51     CRC32       851.116641 KB/s   0.308000087738 s  
k64f      CRC32       1344.328254 KB/s  0.77999997139 s   
k22f      CRC32       1199.743608 KB/s  0.43700003624 s   
nrf51     CRC32       728.177508 KB/s   0.360000133514 s  
kl25z     CRC32       916.588134 KB/s   0.142999887466 s  
lpc824    CRC32       399.609672 KB/s   0.0820000171661 s 
lpc11xx_32PAGE_READ   1365.323785 KB/s  0.0240001678467 s 



------ Test Rate ------
Target    Chip Erase          Page Erase          Page Erase (Same data)

lpc1768   13.274458 KB/s      9.796114 KB/s       20.467209 KB/s      
nrf51     21.557895 KB/s      11.834944 KB/s      36.227750 KB/s      
k64f      24.704929 KB/s      22.322001 KB/s      47.712427 KB/s      
k22f      24.000366 KB/s      19.739016 KB/s      36.812808 KB/s      
nrf51     13.352213 KB/s      9.508996 KB/s       17.404329 KB/s      
kl25z     18.290818 KB/s      13.736324 KB/s      35.300837 KB/s      
lpc824    7.722838 KB/s       3.889377 KB/s       17.964913 KB/s      
lpc11xx_327.013699 KB/s       5.846209 KB/s       20.765528 KB/s      

Target         Test                 Result         Time           

lpc1768        Basic Test           Pass           16.7620000839  
lpc1768        Gdb Server Json Test Pass           0.62299990654  
lpc1768        Speed Test           Pass           7.46399998665  
lpc1768        Cortex Test          Fail           1.75400018692  
lpc1768        Flash Test           Pass           30.2049999237  
lpc1768        Gdb Test             Pass           110.835999966  
nrf51          Basic Test           Pass           5.9509999752   
nrf51          Gdb Server Json Test Pass           0.616000175476 
nrf51          Speed Test           Pass           10.0           
nrf51          Cortex Test          Fail           1.5529999733   
nrf51          Flash Test           Pass           57.3399999142  
nrf51          Gdb Test             Pass           83.7650001049  
k64f           Basic Test           Pass           7.79299998283  
k64f           Gdb Server Json Test Pass           0.618000030518 
k64f           Speed Test           Pass           39.7009999752  
k64f           Cortex Test          Fail           2.26899981499  
k64f           Flash Test           Pass           152.0          
k64f           Gdb Test             Pass           116.526000023  
k22f           Basic Test           Pass           6.80700016022  
k22f           Gdb Server Json Test Pass           0.640999794006 
k22f           Speed Test           Pass           24.0230000019  
k22f           Cortex Test          Fail           1.72400021553  
k22f           Flash Test           Pass           87.7679998875  
k22f           Gdb Test             Pass           113.986999989  
nrf51          Basic Test           Pass           4.11599993706  
nrf51          Gdb Server Json Test Pass           0.637000083923 
nrf51          Speed Test           Pass           17.3919999599  
nrf51          Cortex Test          Fail           1.14499998093  
nrf51          Flash Test           Pass           83.5920000076  
nrf51          Gdb Test             Pass           95.0959999561  
kl25z          Basic Test           Pass           6.32300019264  
kl25z          Gdb Server Json Test Pass           0.655999898911 
kl25z          Speed Test           Pass           5.38599991798  
kl25z          Cortex Test          Fail           1.67500019073  
kl25z          Flash Test           Pass           30.7899999619  
kl25z          Gdb Test             Pass           79.6829998493  
lpc824         Basic Test           Pass           7.32300019264  
lpc824         Gdb Server Json Test Pass           0.630999803543 
lpc824         Speed Test           Pass           3.31900000572  
lpc824         Cortex Test          Fail           1.52900004387  
lpc824         Flash Test           Pass           26.6560001373  
lpc824         Gdb Test             Pass           93.9819998741  
lpc11xx_32     Basic Test           Pass           13.5260000229  
lpc11xx_32     Gdb Server Json Test Pass           0.664000034332 
lpc11xx_32     Speed Test           Pass           2.5680000782   
lpc11xx_32     Cortex Test          Fail           1.03899979591  
lpc11xx_32     Flash Test           Pass           26.7260000706  
lpc11xx_32     Gdb Test             Pass           97.867000103   

Test Time: 1483.04700017
One or more tests has failed!

Chris Reed

unread,
Jun 23, 2016, 3:42:05 PM6/23/16
to mbedmicro/pyOCD

@c1728p9 Right, you don't need any additional Eclipse plugins. It's all done through gdb and standard Eclipse functionality.

KSDK is probably the easiest way to test. Go to kex.nxp.com and generate an SDK for your board (make sure to include FreeRTOS support). The FreeRTOS examples will be under boards/*/rtos_examples.

Chris Reed

unread,
Jun 23, 2016, 3:45:32 PM6/23/16
to mbedmicro/pyOCD

Looking into failure…

Chris Reed

unread,
Jun 23, 2016, 4:03:12 PM6/23/16
to mbedmicro/pyOCD, Push

@flit pushed 1 commit.


You are receiving this because you are subscribed to this thread.

View it on GitHub or mute the thread.

Chris Reed

unread,
Jun 23, 2016, 4:05:35 PM6/23/16
to mbedmicro/pyOCD

Silly bug. I forgot to update cortex_test.py to use the GDBDebugContextFacade.

Russ Butler

unread,
Jun 23, 2016, 4:08:13 PM6/23/16
to mbedmicro/pyOCD

@mbed-bot: TEST

mbed-bot

unread,
Jun 23, 2016, 4:40:59 PM6/23/16
to mbedmicro/pyOCD

Test: FAILURE

Summary:



------ Speed Test Performance ------
Target    Read Speed      Write Speed     

lpc1768   21.543719 KB/s  18.450450 KB/s  
nrf51     34.133332 KB/s  23.076055 KB/s  
k64f      48.073354 KB/s  32.347482 KB/s  
k22f      40.705590 KB/s  28.630844 KB/s  
nrf51     18.143962 KB/s  14.854035 KB/s  
kl25z     37.236359 KB/s  24.786686 KB/s  
lpc824    21.501310 KB/s  18.326621 KB/s  
lpc11xx_3222.021521 KB/s  18.450440 KB/s  



------ Analyzer Performance ------
Target    Analyzer    Rate              Time              

lpc1768   CRC32       1236.528925 KB/s  0.0529999732971 s 
nrf51     CRC32       845.625963 KB/s   0.30999994278 s   
k64f      CRC32       1330.680425 KB/s  0.787999868393 s  
k22f      CRC32       1197.004014 KB/s  0.438000202179 s  
nrf51     CRC32       693.502607 KB/s   0.378000020981 s  
kl25z     CRC32       1040.254567 KB/s  0.125999927521 s  
lpc824    CRC32       409.600391 KB/s   0.0799999237061 s 
lpc11xx_32PAGE_READ   1365.337348 KB/s  0.0239999294281 s 



------ Test Rate ------
Target    Chip Erase          Page Erase          Page Erase (Same data)

lpc1768   13.154557 KB/s      9.822542 KB/s       20.448049 KB/s      
nrf51     21.035468 KB/s      11.440342 KB/s      36.088106 KB/s      
k64f      24.695619 KB/s      22.547112 KB/s      46.861637 KB/s      
k22f      24.199769 KB/s      19.742732 KB/s      36.333195 KB/s      
nrf51     13.268411 KB/s      9.516590 KB/s       17.365130 KB/s      
kl25z     18.329185 KB/s      13.798505 KB/s      40.404439 KB/s      
lpc824    7.764929 KB/s       3.900488 KB/s       19.029037 KB/s      
lpc11xx_327.390167 KB/s       6.011374 KB/s       21.086227 KB/s      

Target         Test                 Result         Time           

lpc1768        Basic Test           Fail           12.9359998703  
lpc1768        Gdb Server Json Test Pass           2.3259999752   
lpc1768        Speed Test           Pass           8.2380001545   
lpc1768        Cortex Test          Pass           5.90799999237  
lpc1768        Flash Test           Pass           30.376999855   
lpc1768        Gdb Test             Pass           111.406000137  
nrf51          Basic Test           Pass           5.8789999485   
nrf51          Gdb Server Json Test Pass           0.733999967575 
nrf51          Speed Test           Pass           9.48500013351  
nrf51          Cortex Test          Pass           4.63599991798  
nrf51          Flash Test           Pass           58.7079999447  
nrf51          Gdb Test             Pass           83.7990000248  
k64f           Basic Test           Pass           7.27500009537  
k64f           Gdb Server Json Test Pass           0.668999910355 
k64f           Speed Test           Pass           39.5650000572  
k64f           Cortex Test          Pass           7.38499999046  
k64f           Flash Test           Pass           150.229000092  
k64f           Gdb Test             Pass           117.25         
k22f           Basic Test           Pass           6.71199989319  
k22f           Gdb Server Json Test Pass           0.630000114441 
k22f           Speed Test           Pass           23.253000021   
k22f           Cortex Test          Pass           5.66199994087  
k22f           Flash Test           Pass           86.7249999046  
k22f           Gdb Test             Pass           115.162000179  
nrf51          Basic Test           Pass           4.10699987411  
nrf51          Gdb Server Json Test Pass           0.625999927521 
nrf51          Speed Test           Pass           17.4130001068  
nrf51          Cortex Test          Pass           4.93899989128  
nrf51          Flash Test           Pass           83.617000103   
nrf51          Gdb Test             Pass           97.0399999619  
kl25z          Basic Test           Pass           6.08999991417  
kl25z          Gdb Server Json Test Pass           0.670000076294 
kl25z          Speed Test           Pass           5.83200001717  
kl25z          Cortex Test          Pass           4.23900008202  
kl25z          Flash Test           Pass           30.1819999218  
kl25z          Gdb Test             Pass           80.243999958   
lpc824         Basic Test           Pass           7.51699995995  
lpc824         Gdb Server Json Test Pass           0.664000034332 
lpc824         Speed Test           Pass           3.2610001564   
lpc824         Cortex Test          Pass           4.60799980164  
lpc824         Flash Test           Pass           26.7810001373  
lpc824         Gdb Test             Pass           95.001999855   
lpc11xx_32     Basic Test           Pass           13.859000206   
lpc11xx_32     Gdb Server Json Test Pass           0.645999908447 
lpc11xx_32     Speed Test           Pass           2.48300004005  
lpc11xx_32     Cortex Test          Pass           4.04399991035  
lpc11xx_32     Flash Test           Pass           25.9300000668  
lpc11xx_32     Gdb Test             Pass           96.2699999809  

Test Time: 1511.0150001
One or more tests has failed!

Chris Reed

unread,
Jun 23, 2016, 4:49:01 PM6/23/16
to mbedmicro/pyOCD

That darn LPC1768 again… ;) Strange that it passed in the first test run but failed just now.

Russ Butler

unread,
Jun 23, 2016, 5:05:11 PM6/23/16
to mbedmicro/pyOCD

@mbed-bot: TEST

mbed-bot

unread,
Jun 23, 2016, 7:06:25 PM6/23/16
to mbedmicro/pyOCD

Test: FAILURE

Summary:



------ Speed Test Performance ------
Target    Read Speed      Write Speed     

lpc1768   21.515430 KB/s  19.944006 KB/s  
nrf51     38.191151 KB/s  30.510245 KB/s  
k64f      48.653304 KB/s  32.580661 KB/s  
k22f      39.313736 KB/s  28.864128 KB/s  
nrf51     17.847495 KB/s  15.031194 KB/s  
kl25z     43.924944 KB/s  23.305830 KB/s  
lpc824    21.167954 KB/s  19.645081 KB/s  
lpc11xx_3222.882664 KB/s  20.686873 KB/s  



------ Analyzer Performance ------
Target    Analyzer    Rate              Time              

lpc1768   CRC32       1213.626500 KB/s  0.0540001392365 s 
nrf51     CRC32       821.768010 KB/s   0.319000005722 s  
k64f      CRC32       1332.370726 KB/s  0.787000179291 s  
k22f      CRC32       1162.501173 KB/s  0.450999975204 s  
nrf51     CRC32       708.497060 KB/s   0.370000123978 s  
kl25z     CRC32       1016.060543 KB/s  0.12900018692 s   
lpc824    CRC32       404.542762 KB/s   0.0810000896454 s 
lpc11xx_32PAGE_READ   1424.695534 KB/s  0.0230000019073 s 



------ Test Rate ------
Target    Chip Erase          Page Erase          Page Erase (Same data)

lpc1768   13.320325 KB/s      9.730661 KB/s       20.359117 KB/s      
nrf51     21.588075 KB/s      11.530923 KB/s      35.964330 KB/s      
k64f      24.732899 KB/s      22.590831 KB/s      46.170402 KB/s      
k22f      23.290303 KB/s      18.875576 KB/s      35.343670 KB/s      
nrf51     13.295329 KB/s      9.524543 KB/s       17.357081 KB/s      
kl25z     18.262784 KB/s      13.768067 KB/s      38.358794 KB/s      
lpc824    7.562428 KB/s       3.862784 KB/s       17.439062 KB/s      
lpc11xx_327.092641 KB/s       5.891406 KB/s       21.487215 KB/s      

Target         Test                 Result         Time           

lpc1768        Basic Test           Pass           20.3239998817  
lpc1768        Gdb Server Json Test Pass           0.634000062943 
lpc1768        Speed Test           Pass           8.01800012589  
lpc1768        Cortex Test          Pass           5.81299996376  
lpc1768        Flash Test           Pass           30.2779998779  
lpc1768        Gdb Test             Pass           110.799000025  
nrf51          Basic Test           Pass           5.71200013161  
nrf51          Gdb Server Json Test Pass           0.633999824524 
nrf51          Speed Test           Pass           8.80000019073  
nrf51          Cortex Test          Pass           4.53499984741  
nrf51          Flash Test           Pass           57.9430000782  
nrf51          Gdb Test             Pass           83.3020000458  
k64f           Basic Test           Pass           6.97000002861  
k64f           Gdb Server Json Test Pass           0.655999898911 
k64f           Speed Test           Pass           39.7179999352  
k64f           Cortex Test          Pass           7.43400001526  
k64f           Flash Test           Pass           151.085000038  
k64f           Gdb Test             Pass           115.643000126  
k22f           Basic Test           Pass           6.69199991226  
k22f           Gdb Server Json Test Pass           0.65499997139  
k22f           Speed Test           Pass           23.1150000095  
k22f           Cortex Test          Pass           5.625          
k22f           Flash Test           Pass           90.0309998989  
k22f           Gdb Test             Pass           113.56400013   
nrf51          Basic Test           Pass           4.18499994278  
nrf51          Gdb Server Json Test Pass           0.644000053406 
nrf51          Speed Test           Pass           17.4010000229  
nrf51          Cortex Test          Pass           4.90100002289  
nrf51          Flash Test           Pass           83.5509998798  
nrf51          Gdb Test             Pass           95.5280001163  
kl25z          Basic Test           Pass           6.05900001526  
kl25z          Gdb Server Json Test Pass           0.675999879837 
kl25z          Speed Test           Pass           5.45399999619  
kl25z          Cortex Test          Pass           4.16900014877  
kl25z          Flash Test           Pass           30.3709998131  
kl25z          Gdb Test             Pass           79.1850001812  
lpc824         Basic Test           Pass           7.47299981117  
lpc824         Gdb Server Json Test Pass           0.652000188828 
lpc824         Speed Test           Pass           3.1899998188   
lpc824         Cortex Test          Pass           4.60900020599  
lpc824         Flash Test           Pass           27.2089998722  
lpc824         Gdb Test             Pass           95.0230000019  
lpc11xx_32     Basic Test           Pass           14.0929999352  
lpc11xx_32     Gdb Server Json Test Pass           0.666000127792 
lpc11xx_32     Speed Test           Pass           2.507999897    
lpc11xx_32     Cortex Test          Pass           4.10899996758  
lpc11xx_32     Flash Test           Pass           26.6909999847  
lpc11xx_32     Gdb Test             Pass           97.8690001965  

Test Time: 1514.19700003
All tests passed

Russ Butler

unread,
Jun 23, 2016, 7:13:48 PM6/23/16
to mbedmicro/pyOCD

@mbed-bot: TEST

mbed-bot

unread,
Jun 23, 2016, 7:46:08 PM6/23/16
to mbedmicro/pyOCD

Test: SUCCESS

Summary:



------ Speed Test Performance ------
Target    Read Speed      Write Speed     

lpc1768   21.729444 KB/s  21.250323 KB/s  
nrf51     38.191130 KB/s  28.444446 KB/s  
k64f      37.449143 KB/s  27.778319 KB/s  
k22f      39.172741 KB/s  27.965011 KB/s  
nrf51     17.522996 KB/s  15.559355 KB/s  
kl25z     42.890056 KB/s  23.540227 KB/s  
lpc824    20.791875 KB/s  16.253970 KB/s  
lpc11xx_3219.598076 KB/s  20.686873 KB/s  



------ Analyzer Performance ------
Target    Analyzer    Rate              Time              

lpc1768   CRC32       1191.562190 KB/s  0.0550000667572 s 
nrf51     CRC32       848.363072 KB/s   0.30899977684 s   
k64f      CRC32       1346.053839 KB/s  0.779000043869 s  
k22f      CRC32       1205.259268 KB/s  0.435000181198 s  
nrf51     CRC32       730.206194 KB/s   0.358999967575 s  
kl25z     CRC32       1023.999832 KB/s  0.128000020981 s  
lpc824    CRC32       348.595370 KB/s   0.0940001010895 s 
lpc11xx_32PAGE_READ   1365.337348 KB/s  0.0239999294281 s 



------ Test Rate ------
Target    Chip Erase          Page Erase          Page Erase (Same data)

lpc1768   13.301400 KB/s      9.917675 KB/s       20.327544 KB/s      
nrf51     21.190203 KB/s      11.638947 KB/s      36.408889 KB/s      
k64f      24.716576 KB/s      22.532577 KB/s      46.574398 KB/s      
k22f      24.016857 KB/s      19.629638 KB/s      36.999859 KB/s      
nrf51     13.318295 KB/s      9.550916 KB/s       17.400863 KB/s      
kl25z     18.278064 KB/s      13.742084 KB/s      38.437536 KB/s      
lpc824    7.746572 KB/s       3.893999 KB/s       17.876705 KB/s      
lpc11xx_326.927696 KB/s       5.851428 KB/s       19.275294 KB/s      

Target         Test                 Result         Time           

lpc1768        Basic Test           Pass           12.756000042   
lpc1768        Gdb Server Json Test Pass           0.613999843597 
lpc1768        Speed Test           Pass           7.47600007057  
lpc1768        Cortex Test          Pass           5.60599994659  
lpc1768        Flash Test           Pass           30.1010000706  
lpc1768        Gdb Test             Pass           110.756999969  
nrf51          Basic Test           Pass           5.75900006294  
nrf51          Gdb Server Json Test Pass           0.644999980927 
nrf51          Speed Test           Pass           8.93499994278  
nrf51          Cortex Test          Pass           4.5            
nrf51          Flash Test           Pass           58.004999876   
nrf51          Gdb Test             Pass           84.3399999142  
k64f           Basic Test           Pass           7.28900003433  
k64f           Gdb Server Json Test Pass           0.661000013351 
k64f           Speed Test           Pass           46.8570001125  
k64f           Cortex Test          Pass           7.37299990654  
k64f           Flash Test           Pass           150.637000084  
k64f           Gdb Test             Pass           116.465999842  
k22f           Basic Test           Pass           6.55700016022  
k22f           Gdb Server Json Test Pass           0.648999929428 
k22f           Speed Test           Pass           23.2769999504  
k22f           Cortex Test          Pass           5.56100010872  
k22f           Flash Test           Pass           87.0230000019  
k22f           Gdb Test             Pass           114.488999844  
nrf51          Basic Test           Pass           4.05900001526  
nrf51          Gdb Server Json Test Pass           0.666000127792 
nrf51          Speed Test           Pass           17.5169999599  
nrf51          Cortex Test          Pass           4.92899990082  
nrf51          Flash Test           Pass           83.4430000782  
nrf51          Gdb Test             Pass           95.0190000534  
kl25z          Basic Test           Pass           5.98000001907  
kl25z          Gdb Server Json Test Pass           0.649999856949 
kl25z          Speed Test           Pass           5.48300004005  
kl25z          Cortex Test          Pass           4.16600012779  
kl25z          Flash Test           Pass           30.4479999542  
kl25z          Gdb Test             Pass           79.7190001011  
lpc824         Basic Test           Pass           7.26599979401  
lpc824         Gdb Server Json Test Pass           0.649000167847 
lpc824         Speed Test           Pass           3.43799996376  
lpc824         Cortex Test          Pass           4.55099987984  
lpc824         Flash Test           Pass           26.7710001469  
lpc824         Gdb Test             Pass           93.9879999161  
lpc11xx_32     Basic Test           Pass           13.6830000877  
lpc11xx_32     Gdb Server Json Test Pass           0.638999938965 
lpc11xx_32     Speed Test           Pass           2.59200000763  
lpc11xx_32     Cortex Test          Pass           3.99900007248  
lpc11xx_32     Flash Test           Pass           26.9099998474  
lpc11xx_32     Gdb Test             Pass           97.3159999847  

Test Time: 1510.21599984
All tests passed

Chris Reed

unread,
Jun 27, 2016, 3:43:01 PM6/27/16
to mbedmicro/pyOCD, Push

@flit pushed 3 commits.

  • d8f14ee Fixed Argon thread DONE state value.
  • 8546b02 Little gdb server fixes for RTOS.
  • ff89984 Fixed reported flash programming statistics.


You are receiving this because you are subscribed to this thread.

View it on GitHub or mute the thread.

Russ Butler

unread,
Jun 27, 2016, 4:18:39 PM6/27/16
to mbedmicro/pyOCD

@mbed-bot: TEST

mbed-bot

unread,
Jun 27, 2016, 5:34:13 PM6/27/16
to mbedmicro/pyOCD

Test: FAILURE

Summary:



------ Speed Test Performance ------
Target    Read Speed      Write Speed     

lpc1768   21.772759 KB/s  21.614775 KB/s  
nrf51     38.102320 KB/s  29.574013 KB/s  
k64f      45.821360 KB/s  31.341941 KB/s  
k22f      39.888010 KB/s  29.204992 KB/s  
nrf51     17.925601 KB/s  15.618684 KB/s  
kl25z     35.772930 KB/s  23.642133 KB/s  
lpc824    20.127761 KB/s  18.044053 KB/s  
lpc11xx_3221.222816 KB/s  17.731588 KB/s  



------ Analyzer Performance ------
Target    Analyzer    Rate              Time              

lpc1768   CRC32       1191.567355 KB/s  0.0549998283386 s 
nrf51     CRC32       821.768010 KB/s   0.319000005722 s  
k64f      CRC32       1334.066135 KB/s  0.786000013351 s  
k22f      CRC32       1197.004665 KB/s  0.43799996376 s   
nrf51     CRC32       730.206194 KB/s   0.358999967575 s  
kl25z     CRC32       1016.062421 KB/s  0.128999948502 s  
lpc824    CRC32       399.609672 KB/s   0.0820000171661 s 
lpc11xx_32PAGE_READ   1365.323785 KB/s  0.0240001678467 s 



------ Test Rate ------
Target    Chip Erase          Page Erase          Page Erase (Same data)

lpc1768   13.323033 KB/s      9.860969 KB/s       20.531329 KB/s      
nrf51     21.646904 KB/s      11.628621 KB/s      36.197736 KB/s      
k64f      24.541871 KB/s      22.594238 KB/s      46.516547 KB/s      
k22f      24.232205 KB/s      19.835351 KB/s      37.313216 KB/s      
nrf51     13.492408 KB/s      9.602696 KB/s       17.640915 KB/s      
kl25z     18.505153 KB/s      13.840760 KB/s      38.801658 KB/s      
lpc824    8.249748 KB/s       3.959879 KB/s       18.639364 KB/s      
lpc11xx_327.153024 KB/s       5.902017 KB/s       20.352793 KB/s      

Target         Test                 Result         Time           

lpc1768        Basic Test           Pass           11.5739998817  
lpc1768        Gdb Server Json Test Pass           0.618000030518 
lpc1768        Speed Test           Pass           7.4240000248   
lpc1768        Cortex Test          Pass           5.54200005531  
lpc1768        Flash Test           Pass           30.1089999676  
lpc1768        Gdb Test             Pass           110.494999886  
nrf51          Basic Test           Pass           6.1400001049   
nrf51          Gdb Server Json Test Pass           0.624000072479 
nrf51          Speed Test           Pass           8.90599989891  
nrf51          Cortex Test          Pass           4.58400011063  
nrf51          Flash Test           Pass           57.8129999638  
nrf51          Gdb Test             Pass           83.2949998379  
k64f           Basic Test           Pass           7.40799999237  
k64f           Gdb Server Json Test Pass           0.640000104904 
k64f           Speed Test           Pass           40.3589999676  
k64f           Cortex Test          Pass           7.21300005913  
k64f           Flash Test           Pass           151.070999861  
k64f           Gdb Test             Pass           117.618000031  
k22f           Basic Test           Pass           6.99300003052  
k22f           Gdb Server Json Test Pass           0.618999958038 
k22f           Speed Test           Pass           22.7330000401  
k22f           Cortex Test          Pass           5.74800014496  
k22f           Flash Test           Pass           85.8320000172  
k22f           Gdb Test             Pass           114.044999838  
nrf51          Basic Test           Pass           4.04099988937  
nrf51          Gdb Server Json Test Pass           0.628999948502 
nrf51          Speed Test           Pass           17.2090001106  
nrf51          Cortex Test          Pass           4.875          
nrf51          Flash Test           Pass           82.6529998779  
nrf51          Gdb Test             Pass           95.506000042   
kl25z          Basic Test           Pass           6.06200003624  
kl25z          Gdb Server Json Test Pass           0.628999948502 
kl25z          Speed Test           Pass           5.89899992943  
kl25z          Cortex Test          Pass           4.18400001526  
kl25z          Flash Test           Pass           30.0310001373  
kl25z          Gdb Test             Pass           78.25          
lpc824         Basic Test           Pass           8.01699995995  
lpc824         Gdb Server Json Test Pass           0.611999988556 
lpc824         Speed Test           Pass           3.28099989891  
lpc824         Cortex Test          Pass           4.54800009727  
lpc824         Flash Test           Pass           25.8250000477  
lpc824         Gdb Test             Pass           92.9419999123  
lpc11xx_32     Basic Test           Pass           14.6940000057  
lpc11xx_32     Gdb Server Json Test Pass           0.650000095367 
lpc11xx_32     Speed Test           Pass           2.63800001144  
lpc11xx_32     Cortex Test          Pass           3.89199995995  
lpc11xx_32     Flash Test           Pass           26.3459999561  
lpc11xx_32     Gdb Test             Pass           96.2590000629  

Test Time: 1497.07599998
All tests passed

Russ Butler

unread,
Jun 27, 2016, 5:37:21 PM6/27/16
to mbedmicro/pyOCD

@mbed-bot: TEST

mbed-bot

unread,
Jun 27, 2016, 6:10:13 PM6/27/16
to mbedmicro/pyOCD

Test: SUCCESS

Summary:



------ Speed Test Performance ------
Target    Read Speed      Write Speed     

lpc1768   21.195343 KB/s  20.673820 KB/s  
nrf51     32.251975 KB/s  24.824239 KB/s  
k64f      45.353633 KB/s  31.319474 KB/s  
k22f      39.646703 KB/s  29.094783 KB/s  
nrf51     17.886465 KB/s  15.142329 KB/s  
kl25z     42.778053 KB/s  24.824248 KB/s  
lpc824    22.818944 KB/s  17.138078 KB/s  
lpc11xx_3222.755577 KB/s  17.808694 KB/s  



------ Analyzer Performance ------
Target    Analyzer    Rate              Time              

lpc1768   CRC32       1213.626500 KB/s  0.0540001392365 s 
nrf51     CRC32       816.647723 KB/s   0.321000099182 s  
k64f      CRC32       1332.371129 KB/s  0.786999940872 s  
k22f      CRC32       1197.004665 KB/s  0.43799996376 s   
nrf51     CRC32       720.176134 KB/s   0.363999843597 s  
kl25z     CRC32       1008.245266 KB/s  0.130000114441 s  
lpc824    CRC32       414.784830 KB/s   0.0789999961853 s 
lpc11xx_32PAGE_READ   1365.337348 KB/s  0.0239999294281 s 



------ Test Rate ------
Target    Chip Erase          Page Erase          Page Erase (Same data)

lpc1768   13.435014 KB/s      9.866907 KB/s       20.557089 KB/s      
nrf51     20.500821 KB/s      11.597239 KB/s      33.573771 KB/s      
k64f      24.731149 KB/s      22.604467 KB/s      45.992193 KB/s      
k22f      24.196419 KB/s      19.750170 KB/s      36.456992 KB/s      
nrf51     13.442593 KB/s      9.558229 KB/s       17.471608 KB/s      
kl25z     18.549675 KB/s      13.881804 KB/s      40.046441 KB/s      
lpc824    7.835486 KB/s       3.968512 KB/s       20.078432 KB/s      
lpc11xx_327.289878 KB/s       5.891406 KB/s       20.978233 KB/s      

Target         Test                 Result         Time           

lpc1768        Basic Test           Pass           12.5529999733  
lpc1768        Gdb Server Json Test Pass           0.608999967575 
lpc1768        Speed Test           Pass           8.10199999809  
lpc1768        Cortex Test          Pass           5.85500001907  
lpc1768        Flash Test           Pass           30.1909999847  
lpc1768        Gdb Test             Pass           110.343000174  
nrf51          Basic Test           Pass           6.01399993896  
nrf51          Gdb Server Json Test Pass           0.617000102997 
nrf51          Speed Test           Pass           9.77199983597  
nrf51          Cortex Test          Pass           4.67000007629  
nrf51          Flash Test           Pass           59.8989999294  
nrf51          Gdb Test             Pass           83.2999999523  
k64f           Basic Test           Pass           7.52100014687  
k64f           Gdb Server Json Test Pass           0.675999879837 
k64f           Speed Test           Pass           40.6570000648  
k64f           Cortex Test          Pass           7.31900000572  
k64f           Flash Test           Pass           151.154999971  
k64f           Gdb Test             Pass           115.84800005   
k22f           Basic Test           Pass           6.48399996758  
k22f           Gdb Server Json Test Pass           0.624000072479 
k22f           Speed Test           Pass           22.7779998779  
k22f           Cortex Test          Pass           5.7009999752   
k22f           Flash Test           Pass           86.7770001888  
k22f           Gdb Test             Pass           114.454999924  
nrf51          Basic Test           Pass           4.08100008965  
nrf51          Gdb Server Json Test Pass           0.605999946594 
nrf51          Speed Test           Pass           17.3139998913  
nrf51          Cortex Test          Pass           5.00500011444  
nrf51          Flash Test           Pass           83.2289998531  
nrf51          Gdb Test             Pass           94.492000103   
kl25z          Basic Test           Pass           6.13000011444  
kl25z          Gdb Server Json Test Pass           0.651999950409 
kl25z          Speed Test           Pass           5.35199999809  
kl25z          Cortex Test          Pass           4.23600006104  
kl25z          Flash Test           Pass           30.1119999886  
kl25z          Gdb Test             Pass           79.1689999104  
lpc824         Basic Test           Pass           7.38700008392  
lpc824         Gdb Server Json Test Pass           0.648000001907 
lpc824         Speed Test           Pass           3.20000004768  
lpc824         Cortex Test          Pass           4.54499983788  
lpc824         Flash Test           Pass           26.1779999733  
lpc824         Gdb Test             Pass           93.3710000515  
lpc11xx_32     Basic Test           Pass           13.1289999485  
lpc11xx_32     Gdb Server Json Test Pass           0.623000144958 
lpc11xx_32     Speed Test           Pass           2.42899990082  
lpc11xx_32     Cortex Test          Pass           3.875          
lpc11xx_32     Flash Test           Pass           26.1540000439  
lpc11xx_32     Gdb Test             Pass           96.7550001144  

Test Time: 1500.59300017
All tests passed

dumarjo

unread,
Jun 29, 2016, 11:03:52 AM6/29/16
to mbedmicro/pyOCD

Is this port support FPU correctly ?

regards

Jonathan

Chris Reed

unread,
Jul 20, 2016, 6:40:51 PM7/20/16
to mbedmicro/pyOCD

@dumarjo Yes, the FPU is fully supported. Tested on Kinetis K22F and K64F.

Chris Reed

unread,
Aug 14, 2016, 5:37:03 PM8/14/16
to mbedmicro/pyOCD

Rebased.

@c1728p9 Have you had a chance to test this?

Russ Butler

unread,
Aug 14, 2016, 6:11:32 PM8/14/16
to mbedmicro/pyOCD

Hi @flit, unfortunately, I haven't yet. It is on my list though, as this would be a very useful feature to have.

Chris Reed

unread,
Aug 14, 2016, 6:12:35 PM8/14/16
to mbedmicro/pyOCD

No worries, just curious.

Matthew Else

unread,
Aug 15, 2016, 8:47:09 AM8/15/16
to mbedmicro/pyOCD

@flit: do you have any plans to add support for RTX/mbed OS?

Chris Reed

unread,
Aug 16, 2016, 10:40:15 AM8/16/16
to mbedmicro/pyOCD

@matthewelse Not myself, though I'd be quite happy to help someone else add RTX. The RTOS support is designed to be easy to add new RTOSes.

Chris Reed

unread,
Dec 31, 2016, 5:09:35 PM12/31/16
to mbedmicro/pyOCD, Push

@flit pushed 1 commit.

  • 0f8cf27 Updated Argon RTOS support and fixed a bug.


You are receiving this because you are subscribed to this thread.

View it on GitHub or mute the thread.

Russ Butler

unread,
Feb 11, 2017, 2:28:13 PM2/11/17
to mbedmicro/pyOCD, Subscribed

I'm not sure this will scale very well if support for each RTOS needs to be added do pyOCD. What would be nice is if the rtos specific code could be moved out of pyOCD and instead live as a plugin.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or mute the thread.

Chris Reed

unread,
Feb 11, 2017, 3:41:39 PM2/11/17
to mbedmicro/pyOCD, Subscribed

I did think about that :) But in practice, there are far fewer RTOSes in common use than even the number of targets or flash algos we have. Not enough to warrant the plugin machinery, imo. Adding a new RTOS via a PR would be similar to adding target devices, except less frequent.

The other major RTOSes used on Cortex-M that are not supported here are: µC/OS-II, µC/OS-III, and RTX. FreeRTOS is by far the most common.

If we do decide to switch to plugins, that could be done in a separate PR.

Chris Reed

unread,
Feb 11, 2017, 5:30:21 PM2/11/17
to mbedmicro/pyOCD, Subscribed

Rebased and squashed.

Chris Reed

unread,
Mar 21, 2017, 7:37:07 PM3/21/17
to mbedmicro/pyOCD, Subscribed

Rebased and refactored commits. Now based on #285, so the debug context and RTOS support have separated. Once #285 is merged, I will rebase this PR to make the changes easier to see. Or you can just look at de9e8a7 (the last commit) to see the RTOS-specific changes.

Chris Reed

unread,
Apr 22, 2017, 3:59:10 PM4/22/17
to mbedmicro/pyOCD, Subscribed

Rebased to remove debug context related commits that were merged in #285.

Russ Butler

unread,
Apr 23, 2017, 6:56:42 PM4/23/17
to mbedmicro/pyOCD, Subscribed

Testing passes on this, but it needs to be rebased

Chris Reed

unread,
Apr 24, 2017, 11:19:03 AM4/24/17
to mbedmicro/pyOCD, Subscribed

Rebased.

Russ Butler

unread,
Apr 26, 2017, 4:25:03 PM4/26/17
to mbedmicro/pyOCD, Subscribed

@c1728p9 commented on this pull request.


In pyOCD/rtos/provider.py:

> +        raise NotImplementedError()
+
+    @property
+    def description(self):
+        raise NotImplementedError()
+
+    @property
+    def is_current(self):
+        raise NotImplementedError()
+
+    @property
+    def context(self):
+        raise NotImplementedError()
+
+## @brief Base class for RTOS support plugins.
+class ThreadProvider(object):

It looks like the functions get_ipsr() (used in common.py) and get_current_thread_id() (used in gdbserver.py) are required to be implemented by subclasses of this. It might be good to add them to this class with NotImplementedError's.

Chris Reed

unread,
Apr 26, 2017, 4:40:43 PM4/26/17
to mbedmicro/pyOCD, Push

@flit pushed 1 commit.

  • f0abe74 Refactored some RTOS provider methods.


You are receiving this because you are subscribed to this thread.

View it on GitHub or mute the thread.

Chris Reed

unread,
Apr 26, 2017, 4:42:15 PM4/26/17
to mbedmicro/pyOCD, Subscribed

@flit commented on this pull request.


In pyOCD/rtos/provider.py:

> +        raise NotImplementedError()
+
+    @property
+    def description(self):
+        raise NotImplementedError()
+
+    @property
+    def is_current(self):
+        raise NotImplementedError()
+
+    @property
+    def context(self):
+        raise NotImplementedError()
+
+## @brief Base class for RTOS support plugins.
+class ThreadProvider(object):

Good catch. Fixed in commit I just pushed. get_ipsr() was moved up to ThreadProvider since it had a common implementation.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or mute the thread.

Russ Butler

unread,
May 6, 2017, 6:04:38 PM5/6/17
to mbedmicro/pyOCD, Subscribed

@c1728p9 commented on this pull request.

I noticed (with my local changes) that stepping in the context of a non-current thread doesn't work. Any idea why this is?


In pyOCD/rtos/freertos.py:

> +        try:
+            return self._threads[id]
+        except KeyError:
+            return None
+
+    def is_valid_thread_id(self, threadId):
+        if not self.is_enabled:
+            return False
+        self.update_threads()
+        return threadId in self._threads
+
+    def get_current_thread_id(self):
+        if not self.is_enabled:
+            return None
+        if self.get_ipsr() > 0:
+            return 2

Why is the handler thread fixed to 2?

Russ Butler

unread,
May 6, 2017, 6:06:16 PM5/6/17
to mbedmicro/pyOCD, Subscribed

Also, I noticed that stepping gets considerably slow when the RTOS is on. Is that primarily what #296 is trying to fix? Could there be an option on the command line to conditionally enable this?

Chris Reed

unread,
May 7, 2017, 2:32:33 PM5/7/17
to mbedmicro/pyOCD, Subscribed

@flit commented on this pull request.


In pyOCD/rtos/freertos.py:

> +        try:
+            return self._threads[id]
+        except KeyError:
+            return None
+
+    def is_valid_thread_id(self, threadId):
+        if not self.is_enabled:
+            return False
+        self.update_threads()
+        return threadId in self._threads
+
+    def get_current_thread_id(self):
+        if not self.is_enabled:
+            return None
+        if self.get_ipsr() > 0:
+            return 2

It just needs an arbitrary, fixed thread ID so gdb will recognize it as the same thread. The default Thread mode (before threading is enabled) thread ID is 1.

Chris Reed

unread,
May 7, 2017, 2:45:42 PM5/7/17
to mbedmicro/pyOCD, Subscribed

To be honest, I hadn't even tried stepping a non-current thread! I'm used to that not working as expected in other debuggers and trained myself to not even try. I'll have to check what gdb sends for the vCont command to see if it's something we could even support. But I suspect it would be very complicated at the least.

Stepping is definitely slower. gdb is causing a thread scan and reading the register context of every thread for each step command, so potentially even multiple times for a user-visible step. You can turn on debug logging to see how frequently this happens.

#296 was indeed intended to help with stepping performance. And it does, a little. The biggest help, of course, is high-speed USB. It's the latency of HID that really gets in the way here.

We could certainly add a command line option to disable RTOS support. Although, imo, you can't really debug a threaded application like that.

Russ Butler

unread,
May 7, 2017, 3:09:25 PM5/7/17
to mbedmicro/pyOCD, Subscribed

@c1728p9 commented on this pull request.


In pyOCD/rtos/freertos.py:

> +        try:
+            return self._threads[id]
+        except KeyError:
+            return None
+
+    def is_valid_thread_id(self, threadId):
+        if not self.is_enabled:
+            return False
+        self.update_threads()
+        return threadId in self._threads
+
+    def get_current_thread_id(self):
+        if not self.is_enabled:
+            return None
+        if self.get_ipsr() > 0:
+            return 2

Ah ok, that makes sense

Chris Reed

unread,
May 7, 2017, 3:14:08 PM5/7/17
to mbedmicro/pyOCD, Subscribed

Fyi, there is an issue I've run into (at least with Argon) where the thread names will end up with garbage values. This is caused by modified code being loaded on a target that was running old code. The SRAM contents will be stale until the app starts running and inits its data and bss. The problem is, there's no good way to identify when the app has reached main().

I have implemented a fix, but it has limits. Basically, it holds off the ThreadProvider from reading thread info until the first resume command following a reset or flash programming. For the common case, this works fine. But there are issues if you don't run to main().

Right now, the fix is in a stash in my local repo. It depends on an event notification system added on another branch, so it's not something I can directly add to the RTOS PR without also bringing in the notification system.

Russ Butler

unread,
May 7, 2017, 3:16:44 PM5/7/17
to mbedmicro/pyOCD, Subscribed

In addition to caching, deferred reads could be used. It would make the driver more complicated, but it would enable many reads to be packed into the same packet, rather than requiring 1 packet for each read.

I use pyOCD to debug my mbed-os code and it's fairly straight forward even with an RTOS, so I think this is a valid use case.

Russ Butler

unread,
May 7, 2017, 3:21:12 PM5/7/17
to mbedmicro/pyOCD, Subscribed

I have noticed something similar. If I reset the device, I'll still see the tasks that were running, since the ram is still preserved. I'm not sure if it is that big of an issue though.

One possible (slight intrusive) way to improve this could be to write to memory to set the RTOS state to inactive on reset. At least for RTX2 there is a variable which indicates the state of the RTOS. I'm not sure if Argon or FreeRTOS have something similar.

Chris Reed

unread,
May 7, 2017, 3:52:07 PM5/7/17
to mbedmicro/pyOCD, Subscribed

That's a good idea, I hadn't thought of clearing just the RTOS state flag. That should work for Argon and FreeRTOS, as well.

Anyway, I pushed up a branch containing my current workaround for you to review: dev_fix_stale_rtos

Russ Butler

unread,
Jul 7, 2017, 11:08:42 AM7/7/17
to mbedmicro/pyOCD, Subscribed

@c1728p9 approved this pull request.

Shrikant Tudavekar

unread,
Jul 7, 2017, 11:25:09 AM7/7/17
to mbedmicro/pyOCD, Subscribed

Can one of the admins verify this patch?

Russ Butler

unread,
Jul 7, 2017, 11:25:23 AM7/7/17
to mbedmicro/pyOCD, Subscribed

/morph test

Russ Butler

unread,
Jul 7, 2017, 5:28:35 PM7/7/17
to mbedmicro/pyOCD, Subscribed

Merged #242.

Reply all
Reply to author
Forward
0 new messages