Unit Testing on RP2040 via Semihosting

I have been working on a project targetting the RP2040 for the past few months and used the WIZ-IO-PICO framework. The platform repo was removed from github a few days ago which is where the wiki was hosted. Flying slightly blind here but I don’t believe there was a page about unit testing anyways. I am using a picoprobe for debugging and have a version of openocd precompiled for picoprobe.

I have had semi-hosting ~working~ for a while but have not attempted to use it for unit testing until today. When I use the debug_testoption and debug, the code uploads successfully and the tests are a success. Additionally, if I run the platformio test command in VScode, it runs successfully.

The problem I run into is if I change the code and attempt to run it again without uploading from the debugger. In verbose test mode, the openocd output reports errors verifying the data uploaded to the pcb. I am convinced my issue is with the test_testing_command. I have looked through a bunch of openOCD documentation, gdbDocs, and dug through the WIZIO-PICO code to try and find the right commands for flashing via picoprobe to no avail. Any pointers would be much appreciated.


#include "unity.h"


#ifndef NULL
#ifndef __cplusplus
#define NULL (void*)0
#define NULL 0

#ifdef __cplusplus
extern "C" {

void unityOutputStart();
void unityOutputChar(char);
void unityOutputFlush();
void unityOutputComplete();

#define UNITY_OUTPUT_CHAR(a)                    unityOutputChar(a) 
//#define UNITY_OUTPUT_CHAR_HEADER_DECLARATION    RS232_putc(int) */
#define UNITY_OUTPUT_FLUSH()                    unityOutputFlush() 
//#define UNITY_OUTPUT_FLUSH_HEADER_DECLARATION   RS232_flush(void) */
#define UNITY_OUTPUT_START()                    unityOutputStart() 
#define UNITY_OUTPUT_COMPLETE()                 unityOutputComplete() 

#ifdef __cplusplus

#endif /* UNITY_CONFIG_H */


#include "unity_config.h"

#include "pico/stdio.h"
#include <stdio.h>

#include <string.h>

#define BUFFER_SIZE 256

static char buffer[BUFFER_SIZE];
static int buffer_index = 0;

int my_putchar(char c) {
    buffer[buffer_index++] = c;
    if (buffer_index == BUFFER_SIZE || c == '\n') {
        // Flush the buffer
        memset(buffer, '\0', sizeof(buffer));
        buffer_index = 0;
    return c;

void unityOutputStart(){

void unityOutputChar(char c){

void unityOutputFlush(){

void unityOutputComplete(){



build_type = test
debug_test = OSAL/test_OSAL
debug_init_break = tbreak _reset_handler

test_framework = unity
test_testing_command = 
  program ${platformio.build_dir}/APPLICATION.elf verify reset
  arm semihosting enable
  reset halt