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

Assembly Startup Files.

Hello,

I'm trying to create a project from scratch and write my own drivers. I have strong background in C but unfortunately I don't know anything about assembly.
I could use a little help to understand the base of the projects / examples that are provided by nRF5 SDK.

I'm using the Segger Embedded Studio. My current version is:
SEGGER Embedded Studio for ARM
Release 4.50  Build 2020021311.41397
Windows x64

First I created a new Project.

File > New Project > Create the project in a new solution > A C/C++ executable for a Cortex-M processor executing from FLASH memory > "Selecting my part number" nRF52832_xxAA > FINISH.

Then I got the file setup you can see in the picture below.

Now, this project runs the main() fine on my nRF52832 module.

The main.c file contains:

File    : main.c
Purpose : Generic application start

*/

#include <stdio.h>
#include <stdlib.h>

/*********************************************************************
*
*       main()
*
*  Function description
*   Application entry point.
*/
void main(void) {
  int i;

  for (i = 0; i < 100; i++) {
    printf("Hello World %d!\n", i);
  }
  do {
    i++;
  } while (1);
}

/*************************** End of file ****************************/

And I saw in debugging printing the "Hello world" as expected.

Now to the question:

Question1: I see different assembly files than the examples have. As long as the project above builds and runs fine can I add my own C code on top of it?
Initializing clocks, etc...

In the examples (to be exact in peripheral/uart example) I saw 3 different assembly files.

ses_startup_nrf_common.s
ses_startup_nrf51.s
thumb.crt0.s

Question 2: What's the difference between them? Do I have to use them or I can just use the ones the Segger Embedded Studio generated?

Parents Reply Children
No Data
Related