Getting started project gpio_led_output doesn't build.

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

Getting started project gpio_led_output doesn't build.

915 Views
randyseedle
Contributor III

I am trying to work through the getting started project at:

FRDM-K64F Platform|Freedom Development Board|Kinetis MCUs | NXP 

The webpage seems to be different than the actual software. The software I am using is:

MCUXpresso Confi Tools Version 5.0
MCUXpresso IDE v10.3.1 [Build 2233] [2019-02-20]

Anyways I tried to wonder through the gpio_led_output project.

It seems to have a build error because the webpage description is different from the actual project source code. Here is the build output.

22:11:25 **** Incremental Build of configuration Debug for project frdmk64f_gpio_led_output ****
make -r -j4 all
Building file: ../source/gpio_led_output.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -std=gnu99 -DFRDM_K64F -DFREEDOM -DSDK_DEBUGCONSOLE=1 -DCR_INTEGER_PRINTF -DPRINTF_FLOAT_ENABLE=0 -DCPU_MK64FN1M0VLL12 -DCPU_MK64FN1M0VLL12_cm4 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -D__REDLIB__ -I../board -I../source -I../ -I../drivers -I../device -I../CMSIS -I../utilities -I../component/serial_manager -I../component/uart -I../component/lists -O0 -fno-common -g3 -Wall -c -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"source/gpio_led_output.d" -MT"source/gpio_led_output.o" -MT"source/gpio_led_output.d" -o "source/gpio_led_output.o" "../source/gpio_led_output.c"
In file included from ../device/fsl_device_registers.h:24:0,
from ../drivers/fsl_common.h:22,
from ../board/clock_config.h:12,
from ../board/board.h:13,
from ../source/gpio_led_output.c:9:
../source/gpio_led_output.c: In function 'main':
../device/MK64F12.h:12162:50: error: called object is not a function or function pointer
#define GPIOB ((GPIO_Type *)GPIOB_BASE)
^
../source/pin_mux.h:56:27: note: in expansion of macro 'GPIOB'
#define BOARD_My_LED_GPIO GPIOB /*!<@brief GPIO device name: GPIOB */
^~~~~
../source/gpio_led_output.c:65:18: note: in expansion of macro 'BOARD_My_LED_GPIO'
GPIO_PinInit(BOARD_My_LED_GPIO GPIOB, BOARD_My_LED_PIN, &led_config);
^~~~~~~~~~~~~~~~~
../device/MK64F12.h:12162:50: error: called object is not a function or function pointer
#define GPIOB ((GPIO_Type *)GPIOB_BASE)
^
../source/pin_mux.h:56:27: note: in expansion of macro 'GPIOB'
#define BOARD_My_LED_GPIO GPIOB /*!<@brief GPIO device name: GPIOB */
^~~~~
../source/gpio_led_output.c:70:25: note: in expansion of macro 'BOARD_My_LED_GPIO'
GPIO_PortToggle(BOARD_My_LED_GPIO GPIOB, 1u << BOARD_My_LED_PIN);
^~~~~~~~~~~~~~~~~
make: *** [source/subdir.mk:26: source/gpio_led_output.o] Error 1

22:11:26 Build Finished (took 370ms)

I attached a zip file of the project to this email. The project was intend to build on a FRDM-K64F platform.

So any ideas what I did wrong ?

0 Kudos
Reply
1 Reply

807 Views
nxf51211
NXP Employee
NXP Employee

Hi,

I've checked your code and found what is your problem. First of all, I see that in your "source" folder you have the library pin_mux.c/.h which is already automatically added to the "board" folder (as you have the same library added twice, you are having issues due to the fact that the same functions are defined in two different files). I recommend you erase these two files from your "source" folder and just leave them at the "board" folder.

Your second issue is at the "gpio_led_output.c" file. Inside the main function, you're adding GPIOB and a define for the same GPIO ("BOARD_My_LED_GPIO") as the first argument for GPIO_PinInit and GPIO_PortToggle functions; you should only have one of these for the first argument, just like this:

    /* Init output LED GPIO. */
 GPIO_PinInit(GPIOB, BOARD_My_LED_PIN, &led_config);

    while (1)
    {
        delay();
        GPIO_PortToggle(GPIOB, 1u << BOARD_My_LED_PIN);

    }‍‍‍‍‍‍‍‍‍

I hope this information can help you.

Ricardo Delsordo

0 Kudos
Reply