Pulse based oscillations

I need to make a stepper motor undergo rotary oscillation with a motion profile.

Then you need to figure out how many steps are required and the speed between steps at the different stages of motion.

Assuming you always need to move (say) 100 steps (180deg) you could have an array that stores the intervals between each step to give the motion you need. You could calculate the interval values on a spreadsheet and just build them into the program.

Then you could use code like the second example in this simple stepper code modified to change the interval based on the data in your array.

...R
Stepper Motor Basics

What motion profile specifically?