Click here to Skip to main content
15,887,464 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Code Snippet 1:

C#
When I "Build" the code, I got following errors.
#include "Bootloader.h"
#include "IFsh1.h"
#include "S19.h"
#include "Shell.h"
#include "WAIT1.h"
#include "LEDR.h"
#include "UTIL1.h"
#include "AS1.h"
#include "KIN1.h"

#define FLASH_PAGE_SIZE             (IntFlashLdd1_ERASABLE_UNIT_SIZE) /* flash page size */
#define BL_FLASH_VECTOR_TABLE       0x0000 /* bootloader vector table in flash */
/* application flash area */
#define MIN_APP_FLASH_ADDRESS        0x1000  /* start of application flash area */
#define MAX_APP_FLASH_ADDRESS       0x7FFFF  /* end of application flash */

#define APP_FLASH_VECTOR_START      0x1000  /* application vector table in flash */
#define APP_FLASH_VECTOR_SIZE       0x410    /* size of vector table */

.
.
.
.

Code Snippet 2:

C++
#include "BL_SW.h"
#include "PORT_PDD.h"
static bool BL_CheckBootloaderMode(void) {
  /* let's check if the user presses the BTLD switch. Need to configure the pin first */
  /* PTB1 as input */
  /* clock all port pins */
  SIM_SCGC5   |= SIM_SCGC5_PORTA_MASK |
             SIM_SCGC5_PORTB_MASK |
             SIM_SCGC5_PORTC_MASK |
             SIM_SCGC5_PORTD_MASK |
             SIM_SCGC5_PORTE_MASK;
  /* Configure pin as input */
#if 0
 /* GPIOB_PDDR: PDD&=~0x0100 */
 GPIOB_PDDR = (uint32_t)((GPIOB_PDDR & (uint32_t)~0x0100UL) | (uint32_t)0x00UL);
 /* Initialization of Port Control register */
 /* PORTB_PCR1: ISF=0,MUX=1 */
 PORTB_PCR1 = (uint32_t)((PORTB_PCR1 & (uint32_t)~0x01000600UL) | (uint32_t)0x0100UL);
#else
  (void)BitIoLdd1_Init(NULL); /* initialize the port pin PTB8 */
  /* enable internal pull-up on PTB1 */
  PORT_PDD_EnablePullupLowPortMask(PORTB_BASE_PTR, 1, PORT_PDD_PULL_UP);
  PORT_PDD_SetPinPullEnable(PORTB_BASE_PTR, 1, PORT_PDD_PULL_ENABLE);

  WAIT1_Waitms(5); /* wait get pull-up a chance to pull-up */
  #endif
    if (!BL_SW_GetVal()) { /* button pressed (has pull-up!) */
      WAIT1_Waitms(50); /* wait to debounce */
      if (!BL_SW_GetVal()) { /* still pressed */
        return TRUE; /* go into boot loader mode */
      }
    }
    /* BTLD switch not pressed, and we have a valid user application vector */
    return FALSE; /* do not enter boot loader mode */
  }


In The Above 2 Code Snippets, error was thrown when I "build" my project in Kinetis Design Studio IDE. The statements which threw error are marked in BOLD font style.
The error statement in code snippet 1 is:

Quote:
Multiple markers at this line
- 'IntFlashLdd1_ERASABLE_UNIT_SIZE' undeclared (first use in this
function)
- each undeclared identifier is reported only once for each function it
appears in

The error statement in code snippet 2 is:

2.A
Quote:
Multiple markers at this line
- 'SIM_SCGC5' undeclared (first use in this function)
- 'SIM_SCGC5_PORTA_MASK' undeclared (first use in this
function)
- 'SIM_SCGC5_PORTB_MASK' undeclared (first use in this
function)
- 'SIM_SCGC5_PORTC_MASK' undeclared (first use in this
function)
- 'SIM_SCGC5_PORTD_MASK' undeclared (first use in this
function)
- 'SIM_SCGC5_PORTE_MASK' undeclared (first use in this
function)

2.B
Quote:
Multiple markers at this line
- 'PORTB_BASE_PTR' undeclared (first use in this
function)


Quote:
Multiple markers at this line
- in expansion of macro 'PORT_PDD_SetPinPullEnable'
- implicit declaration of function 'PORT_PCR_REG' [-Wimplicit-function-
declaration]


What I have tried:

I am using

Hardware: MKE02Z64VLD2

IDE: Kinetis Design Studio.

BL_SW: PTB1

I posted this doubt in many forums and they said, the syntax is not supporting the Kinetis E series controller. They asked me to refer the reference manual of the Kinetis E series controller. But in the reference manual I could not find the proper syntax to fix these errors.

In a nutshell,
In the code snippet 1, I am trying to define a variable for Flash Page Size, but the bad syntax is not supporting KE-02Z controller.
In the code snippet 2, the operation which I am trying to perform with the code snippet 2 is Clocking all the Port Pins, Configuring the PORTB Pin1 (PTB1) as input and, Initialize the port pin PTB1, Enable internal pull-up on PTB1 followed by simple wait statements.
And the Problem with the code snippet 2 is those SIM instruction wont support Kinetis E series controller and the Port Pins are automatically clocked by default after reset. So those 5 statements can just be deleted right ?
Next Error occurs at statements pertaining to enabling the Internal Pull up. How to fix it ?
(Sorry for the long question, my question is pretty straightforward but to make the reader understand my question is quite difficult.)
Thanks in advance.
Posted
Updated 20-Apr-16 20:32pm
v2
Comments
Richard MacCutchan 21-Apr-16 3:40am    
The messages are quite clear, you are trying to use constant names that are not defined anywhere. Check your documentation to see where they are defined.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900