Assembler in C++

Discussion to talk about software related topics only.
Post Reply
fredy-gutierrez
Posts: 12
Joined: Fri Dec 11, 2020 8:27 am

Assembler in C++

Post by fredy-gutierrez »

Hi everyone,

I am working on a project on the MOD M7AE70 board, I am trying to implement assembly code in a Netburner project but I can't find an example that can help me in executing this code Has anyone implemented assembly code in a Netburner project (using c ++) ? How can I implement this in my project?

The reason I want to implement this kind of code is because I want to make interrupts in assembler, I have previously reviewed in the Netburner examples the use of IntervalInterruptCallback, however the interruptions I need to do are too fast (500 microseconds) for what I think that the best way is using assembler to carry out this process.
I will appreciate all help.

Thanks Fredy Gutierrez
User avatar
pbreed
Posts: 1081
Joined: Thu Apr 24, 2008 3:58 pm

Re: Assembler in C++

Post by pbreed »

Nots sure if you want inline asm, or specific asm files...

See nburn\arch\cortext-m7\source\nbrtos_cm7as.s
For an example assembly file...

For inline:
look in :
nburn\arch\cortext-m7\source\nbrtosmain.cpp

Understand that the interrupt processing in the M7 is very different than the coldfire.
You can actually probably just write your interrupt routine in C++ with no assembly wrapper.
No need for INTERRUPT marcos that were using on the coldfire...

500 usec should be easily doable.
Pay Attention to whether your data is in SRAM or DRAM that will have a bigger performance impact than C/assembly.
Can you give an outline of what you are trying to do?
fredy-gutierrez
Posts: 12
Joined: Fri Dec 11, 2020 8:27 am

Re: Assembler in C++

Post by fredy-gutierrez »

Hello, thank you very much for your quickly reply,
I am trying to do an interrupt every 500 microseconds using assembler because I will connect a device to the Netburner by the pins, the device uses two sensors, the sensors send an output (per pin) when something presses it, if an object like a wheel presses the first sensor and then press the other sensor, I can tell the wheel speed by getting the difference between the input time of the first pin and the input time of the second pin, but the wheel speed can be more than 100km / h , so I want to do an interrupt every 500 microseconds to read the pins from the netburner and know when the pins have inputs from the device and the time of the reads, though the speed of the wheel be faster than 100km/h.
Thanks Fredy Gutierrez
User avatar
pbreed
Posts: 1081
Joined: Thu Apr 24, 2008 3:58 pm

Re: Assembler in C++

Post by pbreed »

I would set this up as an edge capture/interrupt and use the stopwatch class to read the time...
Only doing 2 pins?
Post Reply