SIM Macro activation in MCUxpresso

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SIM Macro activation in MCUxpresso

351 Views
ve3id
Contributor III

I'm picking up an old project that was originally built using KDE and later modified using mcuexpresso.

I downloaded the latest version of the IDE and created a new C/C++ project using SDK2.11.0 for the FRDM_K64F board which I have.

I'm copying code from the old project as it had all sorts of stuff I don't want anymore and am trying to build up in the new project from scratch.

The first code I pasted in was a port initialisation.

Problem is when I compile I get "undefined'' errors on all hardware references:

./source/Frere_2016.c:52:1: error: 'SIM_SCGC5' undeclared (first use in this function)
52 | SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK; // Enable Port A Clock Gate C

I have unzipped the SDK with no difference.

It seems that the original source code must have had some assignment made which I am not copying, but surely that should be covered in a new project by the following:

#include <stdio.h>
#include "board.h"
#include "peripherals.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "fsl_debug_console.h"

I even tried adding #include "MK64F12.h" to no avail

Any help really apprecaited!

Thanks

Nigel

 

 

 

 

 

 

So I started

 

 

0 Kudos
Reply
2 Replies

295 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @ve3id 

The compile error happens because SIM_SCGC5 is an old Kinetis register symbol; in MCUXpresso SDK 2.x for FRDM-K64F you should use SIM->SCGC5 and similarly convert the other hardware register references to PERIPHERAL->REGISTER syntax.

For you specific line, change

SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK;

to 

SIM->SCGC5 |= SIM_SCGC5_PORTA_MASK;

 

Thank you.

 

BR

Alice

0 Kudos
Reply

261 Views
ve3id
Contributor III

Thank you very much, Alice.  You are so knowledgeable that you make it look easy!

Now I can get on with my project

cheers

Nigel

 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2387889%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ESIM%20Macro%20activation%20in%20MCUxpresso%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2387889%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI'm%20picking%20up%20an%20old%20project%20that%20was%20originally%20built%20using%20KDE%20and%20later%20modified%20using%20mcuexpresso.%3C%2FP%3E%3CP%3EI%20downloaded%20the%20latest%20version%20of%20the%20IDE%20and%20created%20a%20new%20C%2FC%2B%2B%20project%20using%20SDK2.11.0%20for%20the%20FRDM_K64F%20board%20which%20I%20have.%3C%2FP%3E%3CP%3EI'm%20copying%20code%20from%20the%20old%20project%20as%20it%20had%20all%20sorts%20of%20stuff%20I%20don't%20want%20anymore%20and%20am%20trying%20to%20build%20up%20in%20the%20new%20project%20from%20scratch.%3C%2FP%3E%3CP%3EThe%20first%20code%20I%20pasted%20in%20was%20a%20port%20initialisation.%3C%2FP%3E%3CP%3EProblem%20is%20when%20I%20compile%20I%20get%20%22undefined''%20errors%20on%20all%20hardware%20references%3A%3C%2FP%3E%3CP%3E.%2Fsource%2FFrere_2016.c%3A52%3A1%3A%20error%3A%20'SIM_SCGC5'%20undeclared%20(first%20use%20in%20this%20function)%3CBR%20%2F%3E52%20%7C%20SIM_SCGC5%20%7C%3D%20SIM_SCGC5_PORTA_MASK%3B%20%2F%2F%20Enable%20Port%20A%20Clock%20Gate%20C%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EI%20have%20unzipped%20the%20SDK%20with%20no%20difference.%3C%2FP%3E%3CP%3EIt%20seems%20that%20the%20original%20source%20code%20must%20have%20had%20some%20assignment%20made%20which%20I%20am%20not%20copying%2C%20but%20surely%20that%20should%20be%20covered%20in%20a%20new%20project%20by%20the%20following%3A%3C%2FP%3E%3CP%3E%23include%20%3CSTDIO.H%3E%3CBR%20%2F%3E%23include%20%22board.h%22%3CBR%20%2F%3E%23include%20%22peripherals.h%22%3CBR%20%2F%3E%23include%20%22pin_mux.h%22%3CBR%20%2F%3E%23include%20%22clock_config.h%22%3CBR%20%2F%3E%23include%20%22fsl_debug_console.h%22%3C%2FSTDIO.H%3E%3C%2FP%3E%3CP%3EI%20even%20tried%20adding%20%23include%20%22MK64F12.h%22%20to%20no%20avail%3C%2FP%3E%3CP%3EAny%20help%20really%20apprecaited!%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3ENigel%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CP%3ESo%20I%20started%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2388132%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20SIM%20Macro%20activation%20in%20MCUxpresso%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2388132%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F460%22%20target%3D%22_blank%22%3E%40ve3id%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EThe%20compile%20error%20happens%20because%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%20class%3D%22%22%3ESIM_SCGC5%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eis%20an%20old%20Kinetis%20register%20symbol%3B%20in%20MCUXpresso%20SDK%202.x%20for%20FRDM-K64F%20you%20should%20use%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%20class%3D%22%22%3ESIM-%26gt%3BSCGC5%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eand%20similarly%20convert%20the%20other%20hardware%20register%20references%20to%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%20class%3D%22%22%3EPERIPHERAL-%26gt%3BREGISTER%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Esyntax.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EFor%20you%20specific%20line%2C%20change%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22token%22%3ESIM_SCGC5%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%22%3E%7C%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%22%3ESIM_SCGC5_PORTA_MASK%3C%2FSPAN%3E%3CSPAN%20class%3D%22token%22%3E%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22token%22%3Eto%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22token%22%3ESIM-%26gt%3BSCGC5%20%7C%3D%20SIM_SCGC5_PORTA_MASK%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22token%22%3EThank%20you.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22token%22%3EBR%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22token%22%3EAlice%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2388570%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20SIM%20Macro%20activation%20in%20MCUxpresso%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2388570%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThank%20you%20very%20much%2C%20Alice.%26nbsp%3B%20You%20are%20so%20knowledgeable%20that%20you%20make%20it%20look%20easy!%3C%2FP%3E%3CP%3ENow%20I%20can%20get%20on%20with%20my%20project%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3CP%3Echeers%3C%2FP%3E%3CP%3ENigel%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E