Not able to run Tools/Hello library example script, Pixhawk6C

I was trying to build/run the bare minimum hello script under Tools/Hello on HolyBro Pixhawk6C to get an idea of how library code is written. The script is as follows.

#include <AP_HAL/AP_HAL.h>

void setup();
void loop();

const AP_HAL::HAL& hal = AP_HAL::get_HAL();

void setup()
{
    hal.console->printf("hello world\n");
}

void loop()
{
    hal.scheduler->delay(1000);
    hal.console->printf("*\n");
}

AP_HAL_MAIN();

What I did:

Issue:
After building/uploading to pixhawk, It is not detected by Mission Planner. Furthermore, I am now not able to detect the pixhawk by doing lsub. Neither am I able to find any new serial connections of it under sys/class/tty. Pixhawk’s I/O 's B/E light is solid amber. Could someone please guide me as to where am I going wrong?