Target Freescale Kinetis micro-controllers (K20) More...
#include <cgp_kinetis.h>
Protected Member Functions | |
void | DoCompile (void) |
add my preferences to DoCompile | |
void | DoGenerate (void) |
protected version of generate | |
virtual void | InitialisePorts (void) |
reimplemented/additional code blocks | |
virtual void | DoReadTargetConfiguration (TokenReader &rTr) |
reimplemented/additional code blocks More... | |
virtual void | DoWriteTargetConfiguration (TokenWriter &rTw) const |
File i/o. More... | |
Protected Member Functions inherited from EmbeddedcCodeGenerator | |
virtual void | DecrementTimers (void) |
re-implemented/additional code blocks | |
void | InsertExecHooks (void) |
Helper to insert target code for execution hooks. | |
virtual std::string | TargetAddress (const AA &address) |
abstract address conversion | |
virtual AX | TargetExpression (const AA &address) |
abstract address conversion | |
AX | IntarrayConstant (int offset, const std::vector< int > &val) |
AX | WordarrayConstant (int offset, const std::vector< word_t > &val) |
AX | StrarrayConstant (int offset, const std::vector< std::string > &val) |
virtual void | Comment (const std::string &text) |
Target comments (see EmbeddedcCodeGenerator for consistent reimplementation pattern) | |
virtual void | IntegerDeclare (const AA &address) |
virtual void | IntegerDeclare (const AA &address, int val) |
virtual void | IntegerAssign (const AA &address, int val) |
virtual void | IntegerAssign (const AA &address, const AX &expression) |
virtual void | IntegerIncrement (const AA &address, int val=1) |
virtual AX | IntegerQuotient (const AX &expression, int val) |
virtual AX | IntegerRemainder (const AX &expression, int val) |
virtual AX | IntegerBitmask (const AX &expression) |
virtual AX | IntegerIsEq (const AA &address, int val) |
virtual AX | IntegerIsEq (const AA &address, const AX &expression) |
virtual AX | IntegerIsNotEq (const AA &address, int val) |
virtual AX | IntegerIsNotEq (const AA &address, const AX &expression) |
virtual AX | IntegerIsGreater (const AA &address, int val) |
virtual AX | IntegerIsLess (const AA &address, int val) |
virtual AX | IntegerConstant (int val) |
virtual bool | HasIntmaths (void) |
virtual void | WordDeclare (const AA &address) |
virtual void | WordDeclare (const AA &address, word_t val) |
virtual void | WordAssign (const AA &address, word_t val) |
virtual void | WordAssign (const AA &address, const AX &expression) |
virtual void | WordOr (const AA &address, word_t val) |
virtual void | WordOr (const AA &address, const AX &expression) |
virtual void | WordOr (const AA &address, const AA &op1, const AA &op2) |
virtual void | WordOr (const AA &address, const AA &op1, word_t op2) |
virtual void | WordAnd (const AA &address, word_t val) |
virtual void | WordAnd (const AA &address, const AX &expression) |
virtual void | WordAnd (const AA &address, const AA &op1, const AA &op2) |
virtual void | WordAnd (const AA &address, const AA &op1, word_t op2) |
virtual void | WordNand (const AA &address, const AX &expression) |
virtual AX | WordIsBitSet (const AA &address, int idx) |
virtual AX | WordIsBitClr (const AA &address, int idx) |
virtual AX | WordIsMaskSet (const AA &address, word_t mask) |
virtual AX | WordIsEq (const AA &address, word_t val) |
virtual AX | WordIsNotEq (const AA &address, word_t val) |
virtual AX | WordConstant (word_t val) |
virtual AX | StringConstant (const std::string &val) |
virtual void | CintarrayDeclare (const AA &address, int offset, const std::vector< int > &val) |
virtual AA | CintarrayAccess (const AA &address, int index) |
virtual AA | CintarrayAccess (const AA &address, const AA &indexaddr) |
virtual bool | HasCintarray (void) |
virtual void | CwordarrayDeclare (const AA &address, int offset, const std::vector< word_t > &val) |
virtual AA | CwordarrayAccess (const AA &address, int index) |
virtual AA | CwordarrayAccess (const AA &address, const AA &indexaddr) |
virtual bool | HasCwordarray (void) |
virtual void | CstrarrayDeclare (const AA &address, int offset, const std::vector< std::string > &val) |
virtual AA | CstrarrayAccess (const AA &address, int index) |
virtual AA | CstrarrayAccess (const AA &address, const AA &indexaddr) |
virtual bool | HasCstrarray (void) |
virtual void | IntarrayDeclare (const AA &address, int offset, int len) |
default int-array: not supported | |
virtual void | IntarrayDeclare (const AA &address, int offset, const std::vector< int > &val) |
default int-array: not supported | |
virtual AA | IntarrayAccess (const AA &address, int index) |
default int-array: not supported | |
virtual AA | IntarrayAccess (const AA &address, const AA &indexaddr) |
default int-array: not supported | |
virtual bool | HasIntarray (void) |
default int-array: not supported | |
virtual void | WordarrayDeclare (const AA &address, int offset, int len) |
virtual void | WordarrayDeclare (const AA &address, int offset, const std::vector< word_t > &val) |
virtual AA | WordarrayAccess (const AA &address, int index) |
virtual AA | WordarrayAccess (const AA &address, const AA &indexaddr) |
virtual bool | HasWordarray (void) |
virtual void | IfTrue (const AX &expression) |
virtual void | IfFalse (const AX &expression) |
virtual void | IfWord (const AX &expression) |
virtual void | IfElse (void) |
virtual void | IfElseIfTrue (const AX &expression) |
virtual void | IfEnd (void) |
virtual void | SwitchBegin (const AA &address) |
virtual void | SwitchCase (const AA &address, int val) |
virtual void | SwitchCases (const AA &address, int from, int to) |
virtual void | SwitchCases (const AA &address, const std::set< int > &vals) |
virtual void | SwitchBreak (void) |
virtual void | SwitchEnd (void) |
virtual bool | HasMultiCase (void) |
virtual void | LoopBegin (void) |
virtual void | LoopBreak (const AX &expression) |
virtual void | LoopEnd (void) |
virtual void | FunctionReturn (void) |
virtual void | RunActionExe (const AX &expression) |
virtual void | TimerDeclare (const AA &address, const std::string &litval) |
virtual void | TimerStart (const AA &address) |
virtual void | TimerStop (const AA &address) |
virtual void | TimerReset (const AA &address, const std::string &litval) |
virtual AX | TimerIsElapsed (const AA &address) |
Protected Member Functions inherited from CodePrimitives | |
virtual void | DoGenerateDeclarations (void) |
cut-and-paste template for code snippet assembly | |
virtual void | DoGenerateResetCode (void) |
cut-and-paste template for code snippet assembly | |
virtual void | DoGenerateCyclicCode (void) |
cut-and-paste template for code snippet assembly | |
virtual void | LiteralPrepend (void) |
Cosmetic: prepend literally from configuration data. | |
virtual void | DeclareStatus (void) |
Declare "status". | |
virtual void | DeclareReset (void) |
Declare "reset". | |
virtual void | DeclareRecentEvent (void) |
Declare "recent_event". | |
virtual void | DeclareParallelState (void) |
Declare "parallel_state". | |
virtual void | DeclarePendingEvents (void) |
Declare "pending_events" and "enabled_events". | |
virtual void | DeclareLoopState (void) |
Declare loop state, i.e. line levels, loop flag. | |
virtual void | DeclareTimers (void) |
Use target implementation to declare timers, typically "timer_run_*" and "timer_cnt_*". | |
virtual void | DeclareAux (void) |
Declare variables local to the provided snippets, e.g. helpers for bit-mask computation. | |
virtual void | DeclareLargeCarray (void) |
Declare compiled transition relations. | |
virtual void | DeclareSmallCarray (void) |
Declare bit-mask loop-ups. | |
virtual void | DeclareEventNameLookup (void) |
Declare symbolic name lookup tables. | |
virtual void | DeclareStateNameLookup (void) |
Declare symbolic name lookup tables. | |
virtual void | ResetState (void) |
Reset state. | |
virtual void | ResetReturn (void) |
Reset bail out. | |
virtual void | SenseInputs (void) |
Sense input events and add to "pending_events". | |
virtual void | SenseTimerElapse (void) |
Sense timer elapse vents and add to "pending_events". | |
virtual void | BeginExecutionLoop (void) |
Execution Loop, begin. | |
virtual void | UpdateEnabled (void) |
Update "enabled_events" from "parallel_state" if "exec_event" was set. | |
virtual void | ScheduleEvent (void) |
Select event to execute from "pending_and_enabled_events" or "enabled_events". | |
virtual void | BreakExecutionLoop (void) |
Execution Loop, break. | |
virtual void | ExecuteEvent (void) |
Take transition and figure new state. | |
virtual void | OperateTimers (void) |
Start/stop/reset timers w.r.t. "exec_event". | |
virtual void | OperateOutputs (void) |
Operate output lines w.r.t. "exec_event". | |
virtual void | EndExecutionLoop (void) |
Loop end. | |
virtual void | LiteralAppend (void) |
Cosmetic: append literally from configuration. | |
virtual void | ExecuteEventBySwitching (void) |
Alternative implementation of ExecuteEvent() | |
virtual void | ExecuteEventByInterpreter (void) |
Alternative implementation of ExecuteEventBy() | |
virtual void | UpdateEnabledBySwitching (void) |
Alternative implementations UpdateEnabled() | |
virtual void | UpdateEnabledByInterpreter (void) |
Alternative implementations UpdateEnabled() | |
virtual std::string | TargetSymbol (const std::string &str) |
Mangle string to valid target symbol. | |
virtual void | IntegerDecrement (const AA &address, int val=1) |
virtual void | BooleanDeclare (const AA &address) |
virtual void | BooleanDeclare (const AA &address, int val) |
virtual void | BooleanAssign (const AA &address, int val) |
virtual void | BooleanAssign (const AA &address, const AX &expression) |
virtual AX | BooleanIsEq (const AA &op1, const AA &op2) |
virtual AX | BooleanIsNotEq (const AA &op1, const AA &op2) |
virtual void | BitarrayDeclare (const AA &address, int blen) |
virtual void | BitarrayDeclare (const AA &address, const std::vector< bool > &val) |
virtual void | BitarrayAssign (const AA &address, const std::vector< bool > &val) |
virtual void | BitarrayAssign (const AA &address, const AA &otherarray) |
virtual void | BitarrayClear (const AA &address) |
virtual void | BitarrayFull (const AA &address) |
virtual void | BitarraySetBit (const AA &address, int bitaddr) |
virtual void | BitarraySetBit (const AA &address, const AA &indexaddr, int offset=0, const std::vector< bool > &hint=std::vector< bool >()) |
virtual void | BitarrayClrBit (const AA &address, int bitaddr) |
virtual void | BitarrayClrBit (const AA &address, const AA &indexaddr, int offset=0, const std::vector< bool > &hint=std::vector< bool >()) |
virtual void | BitarrayIsBitSet (const AA &address, const AA &indexaddr, const AA &result, int offset=0, const std::vector< bool > &hint=std::vector< bool >()) |
virtual void | BitarrayOr (const AA &address, const std::vector< bool > &val) |
virtual void | BitarrayOr (const AA &address, const AA &op1, const std::vector< bool > &op2) |
virtual void | BitarrayOrAllWords (const AA &address, const AA &result) |
virtual void | BitarrayAnd (const AA &address, const std::vector< bool > &val) |
virtual void | BitarrayAnd (const AA &address, const AA &otherarray) |
virtual void | BitarrayAnd (const AA &address, const AA &op1, const AA &op2) |
virtual void | BitarrayAnd (const AA &address, const AA &op1, const std::vector< bool > &op2) |
virtual void | BitarrayFindFirst (const AA &address, const AA &result, int offset=0) |
virtual void | EventSetDeclare (const AA &address) |
virtual void | EventSetDeclare (const AA &address, const EventSet &evset) |
virtual void | EventSetAssign (const AA &address, const EventSet &evset) |
virtual void | EventSetInsert (const AA &address, const EventSet &evset) |
virtual void | EventSetInsert (const AA &address, Idx ev) |
virtual void | EventSetInsert (const AA &address, const AA &evaddr) |
virtual void | EventSetInsert (const AA &address, const AA &evaddr, const EventSet &hint) |
virtual void | EventSetErase (const AA &address, const EventSet &evset) |
virtual void | EventSetErase (const AA &address, Idx ev) |
virtual void | EventSetErase (const AA &address, const AA &evaddr) |
virtual void | EventSetErase (const AA &address, const AA &evaddr, const EventSet &hint) |
virtual void | EventSetExists (const AA &address, const AA &evaddr, const AA &result, const EventSet &hint) |
virtual void | EventSetRestrict (const AA &address, const AA &otherset) |
virtual void | EventSetUnion (const AA &address, const AA &op1, const EventSet &op2) |
virtual void | EventSetIntersection (const AA &address, const AA &op1, const EventSet &op2) |
virtual void | EventSetClear (const AA &address) |
virtual void | EventSetFull (const AA &address) |
virtual void | EventSetIsNotEmpty (const AA &address, const AA &result) |
virtual void | EventSetFindHighestPriority (const AA &address, const AA &result) |
virtual AX | InputExpression (const std::string &expression) |
virtual int | StateTargetIdx (size_t git, Idx idx) |
Overload base class to use the vector address only if the respective code option is active) | |
virtual Idx | StateFaudesIdx (size_t git, int idx) |
Overload base class to use the vector address only if the respective code option is active) | |
virtual void | VariableDeclare (const std::string &laddr, const std::string <ype) |
declaration template (optional to facilitate declaration constructs) | |
virtual void | VariableDeclare (const std::string &laddr, const std::string <ype, const std::string &lval) |
Overload base class to use the vector address only if the respective code option is active) | |
Protected Member Functions inherited from CodeGenerator | |
virtual void | DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
Read the configuration from TokenReader, see faudes Type for public wrappers. More... | |
virtual void | DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
Writes the configuration to TokenWriter, see faudes Type for public wrappers. More... | |
Protected Attributes | |
std::string | mKinetisOutputControl |
Kinetis code options. | |
std::string | mKinetisInputControl |
Kinetis code options. | |
Protected Attributes inherited from CodePrimitives | |
std::string | mWordType |
target data type for word | |
std::string | mIntegerType |
target data type for integer | |
std::string | mPrefix |
universal prefix (pseudo name space) | |
bool | mArrayForTransitions |
code option: use const array to represent transitions | |
bool | mMaintainStateIndices |
code option: use state indices as provided | |
bool | mBitAddressArithmetic |
code option: compute bit and word address on target | |
bool | mArrayForBitmasks |
code option: use const array to represent bit-masks | |
bool | mArrayForBitarray |
code option: use const array to represent bit-masks | |
bool | mBisectionForBitfind |
code option: use bisection to fing lowest set bit | |
bool | mArrayForState |
code option: use int arrays to represent that overall state | |
bool | mEventsetsForPerformance |
code option: eventsets for performance | |
bool | mLoopPendingInputs |
code option: loop until all inputs are resolved | |
bool | mLoopEnabledOutputs |
code option: loop until all enabled outputs are executed | |
bool | mStrictEventSynchronisation |
code option: strict event synchronisation | |
bool | mEventNameLookup |
code option: event name lookup | |
bool | mStateNameLookup |
code option: state name lookup | |
std::vector< bool > | mHasStateNames |
record per generator whether there is a lookup table | |
bool | mExistStateNames |
record whether there exist statenames at all | |
std::string | mEventExecutionHook |
code option: event exec hook | |
std::string | mStateUpdateHook |
code option: state change hook | |
std::string | mLiteralPrepend |
extra code to prepend | |
std::string | mLiteralAppend |
extra code to prepend | |
std::map< std::string, bitarray_rec > | mBitarrays |
Record of all declared bit-arrays. | |
Protected Attributes inherited from CodeGenerator | |
std::string | mName |
faudes object name (aka project name) | |
std::vector< TimedGenerator > | mGenerators |
list of executors | |
std::vector< std::string > | mGeneratorNames |
list of filenames when generator are read from file | |
cgEventSet | mAlphabet |
event configuration by attributes | |
int | mWordSize |
compressed boolean capacity of target type word | |
int | mIntegerSize |
compressed boolean capacity of target type integer | |
std::map< Idx, int > | mEventBitAddress |
mapping from faudes event idx to bit address (descending priority, range 0 . More... | |
std::map< int, Idx > | mEventFaudesIdx |
mapping from bit address to faudes event idx | |
int | mLastInputEvent |
highest bit-address with input (or timer) event (-1 for none) | |
int | mLastOutputEvent |
highest bit-address with output event (-1 for none) | |
std::vector< std::map< Idx, int > > | mStateVectorAddress |
mapping from faudes state idx to vector index | |
std::vector< std::map< int, Idx > > | mStateFaudesIndex |
mapping from vector state idx to faudes index | |
std::vector< bool > | mUsingVectorAddressStates |
configuration of state indexing per generator | |
std::vector< std::vector< int > > | mTransitionVector |
compiled transition-sets, represented as vectors of integers with 0 as separator | |
EventSet | mUsedEvents |
configured events that are referred to by some generator | |
EventSet | mOutputEvents |
used events that are configured as outputs | |
EventSet | mInputEvents |
used events that are configured as inputs (incl timer) | |
EventSet | mInternalEvents |
used events that are configured as internal events (excl. More... | |
std::map< std::string, LineAddress > | mLines |
input event generation | |
std::map< std::string, FlagExpression > | mFlags |
input event generation | |
std::map< std::string, TimerConfiguration > | mTimers |
timer definitions | |
std::map< std::string, ActionAddress > | mActionAddresses |
action addresses | |
std::map< std::string, TimerAction > | mTimerActions |
timer actions by event name | |
int | mVerbLevel |
diagnpstic-output level | |
std::string | mOutMode |
output file name (base) | |
char | mMuteMode |
current output mode | |
bool | mMuteComments |
mute comments | |
std::string | mRecentMutedComment |
recent muted comment | |
std::ostream * | pOutStream |
output stream | |
std::ostream * | pErrStream |
error stream | |
Basic Class Maintenance | |
KinetisCodeGenerator (void) | |
virtual | ~KinetisCodeGenerator (void) |
virtual void | Clear (void) |
Re-Implemented Code Primitives | |
void | RunActionSet (const std::string &address) |
void | RunActionClr (const std::string &address) |
AX | ReadInputLine (const std::string &address) |
std::string | ParseLiteralPort (const std::string &port) |
Additional Inherited Members | |
Public Types inherited from CodeGenerator | |
enum | OutSink { CONSOLE , FILE , STRING } |
typedef std::vector< TimedGenerator >::const_iterator | Iterator |
Iterator for read-only access of generators. | |
typedef unsigned long | word_t |
Code-generator internal data type of target words. | |
typedef std::map< std::string, LineAddress >::iterator | LineIterator |
Access to line records by iterator. | |
typedef std::map< std::string, FlagExpression >::iterator | FlagIterator |
Access to flag records by iterator. | |
typedef std::map< std::string, TimerConfiguration >::iterator | TimerIterator |
Access to timer records by iterator. | |
typedef std::map< std::string, ActionAddress >::iterator | ActionAddressIterator |
Access to action record by iterator. | |
typedef std::map< std::string, TimerAction >::iterator | TimerActionIterator |
Access to timer records by iterator. | |
Public Member Functions inherited from EmbeddedcCodeGenerator | |
EmbeddedcCodeGenerator (void) | |
Constructor. | |
virtual | ~EmbeddedcCodeGenerator (void) |
Explicit destructor. | |
Public Member Functions inherited from CodePrimitives | |
CodePrimitives (void) | |
Constructor. | |
virtual | ~CodePrimitives (void) |
Explicit destructor. | |
Public Member Functions inherited from CodeGenerator | |
Idx | Size (void) const |
Number of generators. | |
void | Insert (const std::string &file) |
Add a Generator from file. More... | |
void | Insert (const TimedGenerator &rGen) |
Add a generator by reference. More... | |
const TimedGenerator & | At (int i) const |
Direct access for read-only access of generators. | |
Iterator | Begin (void) const |
Begin-iterator for read-only access of generators. | |
Iterator | End (void) const |
End-iterator for read-only access of generators. | |
virtual int | EventTargetIdx (Idx idx) |
Get target event Idx from faudes Idx (use bit-address + 1) | |
virtual int | EventTargetIdx (const std::string &ev) |
Get target event Idx from faudes name (use bit-address + 1) | |
int | EventBitAddress (Idx idx) |
Get event bit-address from faudes Idx (consecutive, starts at 0) | |
Idx | EventFaudesIdx (int idx) |
Get faudes Idx from target Idx (aka from bit-address + 1) | |
std::vector< bool > | EventBitMask (Idx idx) |
Get vector representation for a single faudes event Idx. | |
std::vector< bool > | EventBitMask (const EventSet &eset) |
Get vector representation for faudes event set. | |
int | EventBitMaskSize (void) |
Get overall number of events. | |
word_t | WordFromBitVector (const std::vector< bool > &vect, int wordindex) |
Extract individual word from boolean vector. | |
std::vector< word_t > | WordVectorFromBitVector (const std::vector< bool > &vect) |
Convert boolean vector to word array. | |
LineIterator | LinesBegin () |
Access to line records by iterator. | |
LineIterator | LinesEnd () |
Access to line records by iterator. | |
FlagIterator | FlagsBegin () |
Access to flag records by iterator. | |
FlagIterator | FlagsEnd () |
Access to flag records by iterator. | |
TimerIterator | TimersBegin () |
Access to timer records by iterator. | |
TimerIterator | TimersEnd () |
Access to timer records by iterator. | |
ActionAddressIterator | ActionAddressesBegin () |
Access to action addresses by iterator. | |
ActionAddressIterator | ActionAddressesEnd () |
Access to action addresses by iterator. | |
TimerActionIterator | TimerActionsBegin () |
Access to timer records by iterator. | |
TimerActionIterator | TimerActionsEnd () |
Access to timer records by iterator. | |
CodeGenerator (void) | |
Constructor. | |
virtual | ~CodeGenerator (void) |
Destructor. | |
virtual void | Name (const std::string &rName) |
Set objects's name (reimplementing base faudes::Type) More... | |
virtual const std::string & | Name (void) const |
Get objects's name (reimplementing base faudes::Type) More... | |
virtual void | Compile (void) |
Compile input data for alternative representation. More... | |
Idx | EventIndex (const std::string &rName) const |
Faudes-event index lookup. More... | |
std::string | EventName (Idx index) const |
Faudes-event name lookup. More... | |
const AttributeCodeGeneratorEvent & | EventAttribute (Idx ev) const |
Event configuration attribute lookup. More... | |
void | EventAttribute (Idx ev, const AttributeCodeGeneratorEvent &attr) |
Set event attribute. More... | |
void | Alphabet (const cgEventSet &rAlphabet) |
Set all event attributes. More... | |
const cgEventSet & | Alphabet (void) const |
Access alphabet (incl event attributes) More... | |
const std::vector< int > & | TransitionVector (size_t git) |
Get target state index (refer to vector representation as default, overload in CodePrimitives) | |
virtual void | Generate (void) |
Generate code. More... | |
void | Verbose (int level, std::ostream *altout=0) |
Set verbosity level. More... | |
virtual void | OutputMode (const std::string &mode) |
Set code output mode. More... | |
std::string | OutputMode (void) |
Report code output mode. More... | |
virtual std::ostream & | Output (void) |
Output stream. More... | |
const std::string & | OutputString (void) |
Get accumulated output as string. More... | |
void | OutputString (const std::string &strbuf) |
Set output to string. More... | |
virtual void | MuteMode (char mode) |
Set current mute mode. More... | |
virtual void | MuteCond (char mode) |
Set mode condition. More... | |
virtual void | LineFeed (int lines=1) |
LineFeed (convenience support for derived classes) | |
virtual std::string | LineCount (void) |
LineFeed (convenience support for derived classes) | |
virtual void | IndentInc () |
Indentation (convenience support for derived classes) | |
virtual void | IndentDec () |
Indentation (convenience support for derived classes) | |
std::string | RecentComment (void) |
Recent muted comment (convenience support for derived classes) | |
virtual void | XmlTextEscape (bool on) |
XmlTextEscape (escape "<", ">", "&", "\"" and "'") | |
virtual void | XmlCdataEscape (bool on) |
XmlCdataEscape (escape "]]>") | |
virtual void | MuteComments (bool on) |
Mute comments (convenience support for derived classes) | |
virtual void | MuteVspace (bool on) |
Mute empty lines (convenience support for derived classes) | |
Static Public Member Functions inherited from CodeGenerator | |
static std::string | VersionString (void) |
Version (refers to macro COMPILEDES_VERSION, defined in cgp_codegenerator.h) | |
static void | Register (const std::string &type, CodeGenerator *(*newcg)(void)) |
Insert derived class in the registry. More... | |
static std::vector< std::string > | Registry (void) |
Access registry contents. More... | |
static CodeGenerator * | New (const std::string &type) |
Instantiate by identifier (returns 0 on unknown class) More... | |
Public Attributes inherited from CodeGenerator | |
std::vector< int > | mWordAddressVector |
Look-up table to map a bit-address to the word-index. | |
std::vector< word_t > | mBitMaskVector |
Look-up table to map a bit-address to the word-bitmask. | |
This code generator is derived from EmbeddedcCodeGenerator to further shape the output to fit Freescale Kinetis K20 microcontrollers. The generated C-code compiles with the arm-none-eabi-gcc
toolchain and requires appropriate headers and/or additional support code for device initialisation and symbolic register access.
The KinetisCodeGenerator requires the word data type to be a 32bit integer and sets the default integer data type to a signed 16 bit integer. Regarding digital i/o, the configuration supports the use of Kinetis K20 native GPIO pin addresses in Set/Clr output actions and as input triggers. If either of the below control parameters are set, the generated code includes the additional function PREFIX_initpio()
to initialise all referenced input and output pins accordingly.
The following additional code-options are supported.
KinetisOutputControl. When this option is set to a non-empty string, the function PREFIX_initpio()
will include code to set all GPIO port-control-registers (PORTx_PCRn) referenced by Set/Clr output actions accordingly. In addition, the ports will be configured as outputs by setting the respective flags in the register PORTx_PDDR. Example: for slow slew-rate and high drive strength use the following target-configuration option:
<KinetisOutputControl val="PORT_PCR_SRE | PORT_PCR_DSE"/>
KinetisInputControl. When this option is set to a non-empty string, the function PREFIX_initpio()
will include code to set the GPIO port-configuration-register referenced by input triggers accordingly. E.g., for passive filter and pullups use the following target-configuration option:
<KinetisInputControl val="PORT_PCR_PFE | PORT_PCR_PE | PORT_PCR_PS"/>
The following example for a Teensy 3.2 board illustrates a typical overall implementation pattern.
The implementation of system time renders one time unit to correspond to 10ms. The toy example blink_k20.cgc was used for validation on an Teensy 3.2 board.
Definition at line 107 of file cgp_kinetis.h.
KinetisCodeGenerator::KinetisCodeGenerator | ( | void | ) |
Constructor
Definition at line 32 of file cgp_kinetis.cpp.
|
virtual |
Explicit destructor.
Definition at line 37 of file cgp_kinetis.cpp.
|
virtual |
Clear all data.
Reimplemented from EmbeddedcCodeGenerator.
Definition at line 43 of file cgp_kinetis.cpp.
|
protectedvirtual |
File i/o
Reads global configuration from TokenReader, excl. label
rTr | TokenReader to read from |
Exception |
|
Reimplemented from EmbeddedcCodeGenerator.
Definition at line 59 of file cgp_kinetis.cpp.
|
protectedvirtual |
Write global configuration to TokenWriter, excl. label
rTw | Reference to TokenWriter |
Exception |
|
Reimplemented from EmbeddedcCodeGenerator.
Definition at line 78 of file cgp_kinetis.cpp.