Baremetal programming

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

Baremetal programming

5,821 Views
smishra125
Contributor I

I am using LPC55S69JBD100 controller of LPCXpresso55S69 Development Board. I am doing baremetal programming and trying to create led blinking project but don't know how to start. I tried to copy CMSIS from arm website but it haven't worked. Since I am beginner in the NXP family, can you send me some links and tutorial to start with the baremetal programming.

I am using MCUXpresso IDE of NXP. 

0 Kudos
Reply
15 Replies

5,718 Views
smishra125
Contributor I

@frank_m @ErichStyger I have followed the document and fulfilled all the steps in it. But when i go for the debugging, after the debugger disappears.

I think my board is supporting 55s28 controller not 55s69 that's why it is not been debugged properly. You can see my board in screenshot. I think my development board has both controllers.

Is this LPC55S69-EVK github example https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/MCUXpresso/LPC55S69-EVK/LPC55S69_CM... is compatible with LPC55s28 controller.

0 Kudos
Reply

5,704 Views
ErichStyger
Specialist I

I think that board might support both devices, but you have to check what is actually on your board.

0 Kudos
Reply

5,711 Views
frank_m
Senior Contributor III

> I think my board is supporting 55s28 controller not 55s69 that's why it is not been debugged properly.

I would think so.
I don't have any LPC55Sxx eval board, but one for a LPC54628 which alternatively supports several MCU variants as well. The one "checkmarked" on the print should be the one you have. But I would cross-check with the label of the MCU.

But generally, Flash / RAM areas of different variants do not match in both size and start addresses. Thus debugging fails already during the flash process.

A pragmatic solution would be to setup the LPCXpresso project again for the 55S28 controller, and continue with this board for the time being..
If you application needs the 55S69, you could have a proper "replacement" board ordered in the meantime.

0 Kudos
Reply

5,708 Views
smishra125
Contributor I

@fre Do you have baremetal project example for LPC55S28 controller

0 Kudos
Reply

5,715 Views
smishra125
Contributor I

May be this screenshot will help to understand the situation better.

0 Kudos
Reply

5,757 Views
smishra125
Contributor I

@frank_m @ErichStyger I have successfully compiled the project and imported the debug folder into McuXpresso IDE. I have done the similar configuration you have said in the link but it shows error as jlink is not connected. Am i missing something as my xpresso board is on default setting or i need to connect the external debugger.

0 Kudos
Reply

5,752 Views
frank_m
Senior Contributor III

Can you see the JLink in the device manager (assuming Windows) ?
On Linux, you could use the lsusb command.

The respective drivers should be installed as well.
This installation usually puts Segger tools on your system, check "applications->Segger->J-Link Vn.nn" in your Windows menu.
If it is not there, the driver(s) are probably not installed.

0 Kudos
Reply

5,750 Views
smishra125
Contributor I

@frank_m  I think i have installed the jlink software and thinks if the configuration on the board needs to be changed.

0 Kudos
Reply

5,786 Views
smishra125
Contributor I

@ErichStyger I am getting the error while running the cmake.init as in screenshot. 

0 Kudos
Reply

5,778 Views
ErichStyger
Specialist I

not sure, but it looks like make is not found?

0 Kudos
Reply

5,796 Views
smishra125
Contributor I

@ErichStyger  @frank_m Thanks for the support. I will implement it today. 

0 Kudos
Reply

5,802 Views
ErichStyger
Specialist I

Hi @smishra125 ,

I recommend you start with the NXP SDK examples (): they are pretty easy to understand, and there is a 'blinky' example too.

Get the SDK from https://mcuxpresso.nxp.com/, drag it into the 'Installed SDK' view of the IDE and start coding. Or use the view: Menu Show > View > Install MCUXpresso SDK.

Use the Import SDK Example from the Quickstart Panel:

ErichStyger_0-1668526044324.png

Select your board:

ErichStyger_1-1668526090620.png

then import the 'blinky':

ErichStyger_2-1668526119165.png

 

build and debug, and you should have it running.

 

In case you want to go bare-bare metal with CMake, I wrote about this here: https://mcuoneclipse.com/2022/09/04/tutorial-creating-bare-bare-embedded-projects-with-cmake-with-ec...

But this is more for the Pro, if you are well in CMake and the GNU build tools.

 

I hope this helps,

Erich

0 Kudos
Reply

5,808 Views
frank_m
Senior Contributor III

> I tried to copy CMSIS from arm website but it haven't worked.

ARM's CMSIS only covers the generic part of the core, common to all vendors. You will not find anything specific there.

My recommendation would be to start with the user manual of the MCU (the PDF), and the SDK for your MCU (for the MCUxpresso IDE).

The user manual provides the description of all required core and peripheral registers, and the required sequence(s) to achieve certain functionalities.

The SDK provides example implementation for most of the interesting/relevant use cases.

Starting from there, you could understand and reproduce the functionality of the examples, start to strip it down, and remove code/functionality unnecessary for your application.

However, compared to other environments (e.g. a competitor's tool/IDE named after a 3D geometric object), NXP's SDKs come with very little overhead, and without questionably design framework choices forced upon the user.

In a commercial environment, such bare-metal coding is only oursued when the (often relatively small) gains in performance and size outweights the reduced portability and testability, and increased development time and costs.

 

0 Kudos
Reply

5,770 Views
Oxolotol
Contributor III

I started with a different example, and am trying to port blinky timer to it.  But I can't find where blinky enables the systick interrupt. It's not described in the read me.

0 Kudos
Reply

5,760 Views
frank_m
Senior Contributor III

The systick timer, as part of the core, is handled in ARM CMSIS functions.
Usually as a call to SysTick_Config(), which is an inline function implemented in core_cm<x>.h (core_cm4.h in my case).
At least it was last time I used it.

This function enables the interrupt as last step.

0 Kudos
Reply