This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Blink questio what are those file do.

Hello, I am new to NRF. and actually i dont have other MCU experience, beside adrduino. my question is not about BLE/BLE+, it's more about how to use NRF5283 in keil question.

I did comple the blynk example. and the LEDS does on from 1to4 and, vanished from 1to4 it works ok.

MY QUESTION IS WHAT IS THE PURPPOSE MEANING FOR EACH FILES???? it's ask from a begnner like me becuase compare arduino, hello world example which is blink example, arduino only have 1 file.

But NRF5283 example have so many files in the BLINK PROJECT. and i did try to dig into the detail of each file, but i really have a hard time to understand each file purpose and meaning.

I know blink is the "hello world" in mcu, and nrf5283. but AS a BEGINNER , a BLINK hellow wolrd project, contain of 8 other files..... It's really Overwhelming for me.

so COULD ANYONE KINDLY BREIFERLY DESCRIPE ALL THE 8 FILES IN THE BLINK PROJECTS FOR ME. why I ask these question, is also really asking, what is the basic seting for NRF5X if i want to use keil from scratch.

In my head, I was imagine there is something like the tutorial in ARMkeil like this youtube www.youtube.com/watch but in NRF5XX version

thanks.

Blink project

main.c

function LEDS_CONFIGURE(LEDS_MASK); LEDS_INVERT(1 << leds_list[i]); nrf_delay_ms(2500);

files

  1. stdbool.h

  2. stdint.h 3 "nrf_delay.h"

4 "nrf_gpio.h"

5 "boards.h"

6 nrf_delay.c

7 complier_abstraction.h

8 system_nrf52.c

  • Hello Louis Lu

    The different files included in your project all contain definitions and functions you can use in your application code. The SDK (software development kit) contains many different “modules” which you can include into your project if you need them. Each module contain definitions and function calls you can use in your code to use the hardware of the IC’s.

    The idea is that you will only include the modules you need for your project, so if you need to communicate with other IC’s on the board with UART you will add the UART module. If you want to use the ADC, you add the ADC module.

    Modules often come with at least two files. A header file with a .h extension, and a source file with a .c extension. The header file will contain defines and function headers, along with explanations of the functions, its arguments and return values. The source file will contain the actual functions with body and all.

    The files you list do the following.

    1. “stdbool.h”: Header file which defines the Boolean variable type. This allows you to create variables which can be set to “true” or “false”.
    2. “stdint.h”: Header file which defines variable types of varying bit-sizes. Such as uint8_t and uint32_t (8-bit unsigned integer and 32-bit unsigned integer).
    3. “nrf_delay.h”: Header file which contains macros and function headers for delaying execution of next instruction. This file is accompanied by the “nrf_delay.c” source file (See point 6).
    4. “nrf_gpio”: Header file, contains defines for the “General purpose in/out” (GPIO) of the chip. This allows you to configure and manipulate the IC’s pins.
    5. “boards.h”: Header file which contain defines for the specific development kit you are using. As well as function headers for manipulating the leds, buttons on the board. This file is accompanied by the “boards.c” source file which contain the actual function definitions.
    6. nrf_delay.c: Source file which contains definition of function nrf_delay_ms. Accompanied by the “nrf_delay.h” header file. (see point 3).
    7. “Compile_abstraction.h”: Header file which contains wrapping for compiler functions.
    8. “system_nrf52.c”: Source file which contains functions for initializing system clocks, system reset, and tracing. Accompanied by the “system_nrf52.h” header file.

    In the main.c file only stdbool.h, stdint.h, nrf_delay.h, nrf_gpio.h and boards.h are included. These files, and their source files, then include other files which they are dependent on. That is why you can see a large number of files attached to your project, even though you only include a few of them in main.

    Information on the different modules can also be found under the Software Development Kit chapter on Nordic Infocenter. infocenter.nordicsemi.com/index.jsp

    Best regards

    Jørn Frøysa

  • I dont know if I understand correctly the Blink project has both C++ and Assembly written language? that in C++ i can call to Assembly language functions. vise versa? is my understanding correct?

  • Everything in the SDK is mainly written in embedded C, but assembly can also be used if it is declared with the __ASM or __asm type. For an example of this see the “nrf_delay.h” header file in the blinky project. For more information on this please see ARMs infocenter on the compiler feature.

    infocenter.arm.com/.../index.jsp

    For information on mixing C/C++ and Assembly please see the following link on ARMs infocenter

    infocenter.arm.com/.../index.jsp

Related