Skip to content

Technically SWO is a single trace pin which is used to stream out data packets with a certain clock rate, derived from the CPU core clock. You can think of SWO as a kind of UART TX pin using a special format to send out data packets. Up to 32 packet types (or stimulus) can be used.

Notifications You must be signed in to change notification settings

RaysoftTechnologiesInc/SerialWireOutLibraryMbed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This library is used to send debug messages as strings via a single trace pin which is used to stream out data packets. SWO is a single trace pin which is used to stream out data packets with a certain clock rate, derived from the CPU core clock.

#Installation/Setup In the launch.json file of the project, the SWO can be configured as follows snd with each output port also to be configured. For example to have SWO_Channel_0 output, we can configure as follows

"swoConfig": 
            {
                "enabled": true,
                "swoFrequency": 115200,
                "cpuFrequency": 100000000,
                "source": "probe",
                "decoders": 
                [
                    {
                        "port": 0,
                        "label": "SWO_Channel_0",
                        "type": "console",
                        "number": 0,
                        "encoding": "ascii"
                    }
                ]
            }

Other channels can be added under the decoders array of the the json with their configuration parameters.

Getting Started

Clone the SWOLogger Library to the directory containing your project.

Example

#include "mbed.h"
#include "SWOLogger.h"



Thread t2;
Thread t3;
Thread t4;


void test_thread(void const *name) 
{
    SWOLogger myLogger = SWOLogger::getLogger(Error);
    
    while (true) 
    {
      myLogger.SWOLog("Thes is my [Error] log, and I love it much\r\n");
    }
}

void test_thread1(void const *name) 
{
    
    SWOLogger myLogger = SWOLogger::getLogger(Warning);
    while (true) 
    {
      myLogger.SWOLog("Thes is my [Warning] log, and I love it much\r\n"); 
    }
}

void test_thread2(void const *name) 
{
    SWOLogger myLogger = SWOLogger::getLogger(Info);
    while (true) 
    {
      myLogger.SWOLog("Thes is my [Info] log, and I love it much\r\n");
    }
}

int main()
{     
    t2.start(callback(test_thread,  (void *)"Th 2"));
    t3.start(callback(test_thread1, (void *)"Th 3"));
    t4.start(callback(test_thread2, (void *)"Th 4"));
      
}

About

Technically SWO is a single trace pin which is used to stream out data packets with a certain clock rate, derived from the CPU core clock. You can think of SWO as a kind of UART TX pin using a special format to send out data packets. Up to 32 packet types (or stimulus) can be used.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published