Can someone tell me how to create an assembly only program for the Kinetis

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

Can someone tell me how to create an assembly only program for the Kinetis

Jump to solution
2,103 Views
pratiekbhadrana
Contributor III

Hello everyone! I have previous experience with PICs and 8051s. I actually came to Freescale looking for 8 bit chips (S08 series), but it was recommended by the forum to switch to the ARM cored Kinetis. I am now doing a basic study of the Kinetis vis-a-vis dear old PIC. In my opinion to really get to know a MCU, you must do at least a fwe programs with assembly. Is there a way to create simple assembly only program using Kinetis Design Studio or some other editor, maybe like toggle LEDs or internal addition, subtraction, etc.

Labels (1)
Tags (1)
1 Solution
1,287 Views
BlackNight
NXP Employee
NXP Employee

Have a look at

http://mcuoneclipse.com/2014/11/15/tutorial-how-to-erase-the-flash-with-the-gnu-debugger/

where I have created an assembly only program with Kinetis Design Studio.

Basically create a normal C project, then remove everything you do not need (C files), and add your assembly code.

The project is on GitHub too: https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-KL25Z/FRDM-KL25Z_Erase

I hope this helps,

Erich

View solution in original post

10 Replies
1,288 Views
BlackNight
NXP Employee
NXP Employee

Have a look at

http://mcuoneclipse.com/2014/11/15/tutorial-how-to-erase-the-flash-with-the-gnu-debugger/

where I have created an assembly only program with Kinetis Design Studio.

Basically create a normal C project, then remove everything you do not need (C files), and add your assembly code.

The project is on GitHub too: https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-KL25Z/FRDM-KL25Z_Erase

I hope this helps,

Erich

1,287 Views
pratiekbhadrana
Contributor III

Thanks Erich. Exactly what I wanted!

Noch eine Frage......Sind Sie Deutsch?

0 Kudos
1,287 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Freescale provides flexible tools for customer to develop Kinetis project easily.

Please check Processor Expert tool, which provides graphic setting panels and can generate code automatically.

More detailed info, please check below link:

http://www.freescale.com/webapp/sps/site/homepage.jsp?code=BEAN_STORE_MAIN

As Mark mentioned, the assembly code also code be got from C code compiled assembly code.

Freescale provides lots of Kinetis sample code (based on C ) for your reference.


Wish it helps.
best regards
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,287 Views
pratiekbhadrana
Contributor III

Thanks Ma Hui. Where are the links to the code examples? I searched a lot, but couldn't find any or are the examples generated by Processor Expert( I haven't yet had a chance to run it, been bubsy with other stuff !!) ?

0 Kudos
1,287 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Sorry for the later reply.

Could you let me know which Kinetis product you want to use? Or which Kinetis family you want to use?

Then I could guide where to find the example code.


Wish it helps.
best regards
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,287 Views
pratiekbhadrana
Contributor III

I will be using Kinetis K20_72 family of MCUs

0 Kudos
1,287 Views
mjbcswitzerland
Specialist V

Pratiek

You can write assembler in KDS,

However one advantage of the Cortex is that it doesn't need any assember code (this one of the marketing gags pushed when it was first released).

If you write in C code you can also simply compare the generated assember that the C compiler creates, if you are interested in it.

Regards

Mark

1,287 Views
pratiekbhadrana
Contributor III

Hi Mark, thanks for your reply. I will definitely try out your method. But just out of curiosity, how does one write assembly in KDS? I'm new to the Eclipse based IDE as well.

0 Kudos
1,287 Views
mjbcswitzerland
Specialist V

Pratiek

I think you just need to use a file with the extension *.s.

Just type in the assembler code as text and build.

It is not KDS really that is doing the work, it is the GCC compiler. All further details can be found from GCC assembler guides for the Cortex M4.

Today very few people write code in assembler (apart from maybe a few small routines that need to be strictly maintained). When I have to do this I just write the code in C and then look at what the compiler generated - anything not understood can be studied from the M4 instruction set details. Sometimes a human can modify the code to save a couple of instructions or make it a little more efficient - often the compiler/assembler already has done a better job that the average human could do anyway.

Some programmers write all code in assembler because they can do it better that a C compiler can. They often take a lot longer to do it (and get it to work in all test cases) though and their code generally can't be maintained by other people. If the project needs to be ported to another processor architecture they have to start again (virtually nothing can be ported). Although they swear that this is the only strategy to get optimal code I don't think that anyone would actually hire or pay them to do it....

Regards

Mark

0 Kudos
1,287 Views
pratiekbhadrana
Contributor III

Thanks Mark

0 Kudos