Regarding # 3 - making sure that it is transferred to the PC, here is the strategy I use:
First go through the inline code and change any 'int' or 'unsigned long' to 'int16' or 'uint32' (or any other convention you choose).
Wrap the section in the inline header, where you define the types inside the condition:
#ifndef CORE_TYPE_DEFINITIONS #define CORE_TYPE_DEFINITIONS typedef long int16; #endif
create the file "PC_Types.h", which defines the same types for PC.
#ifdef CORE_TYPE_DEFINITIONS #error "Core Types already defined" #else #define CORE_TYPE_DEFINITIONS typedef short int16; #endif
In the PC project, create a shell for each embedded c file that contains the following:
#include "PC_Types.h" #include "ModuleX.c"
Wrapping each file, you have all the related functions available as needed. # including the original source file in your shell file, you can opt out of firmware updates directly from your version control system without any changes. Adding test functions after turning on the source gives the test code full access to all functions of the module, even if they do not have a public header.
Ashelly
source share