1. Create an Assembler project in Atmel Studio selecting the target CPU device. In the project generated folder copy the `kernel` file folder from github's project repository
2. Find the generated entry point assembler file and delete its content.
3. Include "kernel/interrupt.inc" - modify its content with the interrupt entry points your project is going to use. Make sure 0x00 (RESET interrupt vector) and 8bit timer1 overflow (SystemTickInt interrupt vector) are there.
4. Include "kernel/kernel.inc" - core kernel API definitions
5. Include "kernel/hardware.inc" - CPU specific registers to initialize 8bit timer1 and software interrupt(optional)
6. Add _BOOT macro to initialize RAM memory
7. Open up "kernel/config.inc" and change TASKS_NUMBER definition to correspond the number of tasks you want to register, set the Program Counter register size to fit your CPU (2 or 3 bytes, consult the CPU documentation). Enable DEBUG flag.
8. Register each tasks with _REGISTER_TASK_STACK or _REGISTER_TASK macro right after _BOOT macro
9. Add _START_SCHEDULAR macro to set the micro kernel in motion
10. Include assembler files with your tasks definition.
11. Set break points in any task to verify the kernel is running in Atmel Studio debugger.
Start from sample project at acorn-kernel-samples github repository or the demo project of the micro kernel.1. Open the project in Atmel Studio and change the target CPU device to match your own project.
2. Open "kernel/interrupt.inc" - modify its content with the interrupt handlers your project is going to use.
3. Open "kernel/hardware.inc" - change CPU device specific registers to initialize 8bit timer1 and software interrupt(optional)
4. Open "kernel/config.inc" and change TASKS_NUMBER to correspond the number of tasks you want to register, set the Program Counter register size to fit your CPU (2 or 3 bytes, consult the CPU documentation). Enable DEBUG flag.
5. Register each tasks with _REGISTER_TASK_STACK or _REGISTER_TASK macro right after _BOOT macro
6. Include assembler files with your tasks definition, delete old ones from sample project
7. Set break points in any task to verify the kernel is running in Atmel Studio debugger.
Basic Task code structure.
hello-world-task:
;initialization section - executed only once
rcall init_led_port
;optional synchronization barrier to guarantee that other tasks has passed init section too
_THRESHOLD_BARRIER_WAIT InitTasksBarrier,TASKS_NUMBER
hello-world-main:
;blink LED forever
sbi PORTF,PF0
_SLEEP_TASK 255
cbi PORTF,PF0
_SLEEP_TASK 255
rjmp hello-world-main