Cornell University ECE4760
Getting Compile information

Pi Pico RP2040/2350

It is sometimes useful for a running program to know when it was compiled, and with which version of the SDK, and for which target board.
This simple example just prints the information when the program boots up. The example prints the following:

Compiled file: start_message_example.c
Compile time/date: 11:39:05  Dec 25 2024
SDK version: 2.1.0  Board: Pico2-rp2350
Windows User name: bruce
ProtoThreads: pt_cornell_rp2040_v1_3.h
Application: Compile message test -- bruce.land@cornell.edu

There are predefined macros in C for several functions related to compilation.
Here we are using the following:

In addition, various automatically generated macros are defined by the Pico compile process.
The two used here are:

This simple program just packages the environment variables into strings and prints them.
I think that it will be useful to me for documenting when examples are generated. It may be
useful to you for version control. and documenting when an assignment was actually done.

All of the logic for the decode and printing is in one function, except for the macro which defines
the protothreads version. This needs to be added to the begining of the program to identify the
the threader to the function.

// protothreads header
#define threader "pt_cornell_rp2040_v1_3.h"
#include threader
  
Code, Project ZIP

Copyright Cornell University December 27, 2024