main: move kernel start routine to kernel/
This commit is contained in:
parent
75d2fb4470
commit
b7e9187740
3 changed files with 9 additions and 26 deletions
|
@ -71,7 +71,7 @@ configure_file(
|
||||||
|
|
||||||
add_subdirectory(arch)
|
add_subdirectory(arch)
|
||||||
|
|
||||||
add_subdirectory(init)
|
#add_subdirectory(init)
|
||||||
add_subdirectory(kernel)
|
add_subdirectory(kernel)
|
||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ add_custom_command(
|
||||||
COMMAND ${CMAKE_LINKER}
|
COMMAND ${CMAKE_LINKER}
|
||||||
ARGS ${ARDIX_LINKER_FLAGS} -o ardix.elf
|
ARGS ${ARDIX_LINKER_FLAGS} -o ardix.elf
|
||||||
$<TARGET_FILE:ardix_arch>
|
$<TARGET_FILE:ardix_arch>
|
||||||
$<TARGET_FILE:ardix_init>
|
#$<TARGET_FILE:ardix_init>
|
||||||
$<TARGET_FILE:ardix_kernel>
|
$<TARGET_FILE:ardix_kernel>
|
||||||
$<TARGET_FILE:ardix_kernel_fs>
|
$<TARGET_FILE:ardix_kernel_fs>
|
||||||
$<TARGET_FILE:ardix_lib>
|
$<TARGET_FILE:ardix_lib>
|
||||||
|
|
|
@ -14,6 +14,7 @@ target_sources(ardix_kernel PRIVATE
|
||||||
io.c
|
io.c
|
||||||
kent.c
|
kent.c
|
||||||
kevent.c
|
kevent.c
|
||||||
|
main.c
|
||||||
mutex.c
|
mutex.c
|
||||||
ringbuf.c
|
ringbuf.c
|
||||||
sched.c
|
sched.c
|
||||||
|
|
|
@ -1,25 +1,17 @@
|
||||||
/* See the end of this file for copyright, license, and warranty information. */
|
/* See the end of this file for copyright, license, and warranty information. */
|
||||||
|
|
||||||
#include <arch/hardware.h>
|
|
||||||
|
|
||||||
#include <ardix/io.h>
|
#include <ardix/io.h>
|
||||||
#include <ardix/kent.h>
|
#include <ardix/kent.h>
|
||||||
#include <ardix/kevent.h>
|
#include <ardix/kevent.h>
|
||||||
#include <ardix/sched.h>
|
#include <ardix/sched.h>
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define REG_PIOB_PER (*(uint32_t *)0x400E1000U)
|
|
||||||
#define REG_PIOB_PDR (*(uint32_t *)0x400E1004U)
|
|
||||||
#define REG_PIOB_OER (*(uint32_t *)0x400E1010U)
|
|
||||||
#define REG_PIOB_ODR (*(uint32_t *)0x400E1014U)
|
|
||||||
#define REG_PIOB_SODR (*(uint32_t *)0x400E1030U)
|
|
||||||
#define REG_PIOB_CODR (*(uint32_t *)0x400E1034U)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Core init routine.
|
* Core init routine.
|
||||||
*
|
*
|
||||||
|
@ -28,8 +20,6 @@
|
||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
volatile unsigned int print_count = 0;
|
|
||||||
|
|
||||||
int err = kent_root_init();
|
int err = kent_root_init();
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
return err;
|
return err;
|
||||||
|
@ -50,21 +40,13 @@ int main(void)
|
||||||
|
|
||||||
/* we should have a serial console now */
|
/* we should have a serial console now */
|
||||||
|
|
||||||
REG_PIOB_OER = 1 << 27;
|
printf("Ardix version " ARDIX_VERSION_STR "\n");
|
||||||
REG_PIOB_PER = 1 << 27;
|
printf("This is non-violent software, and there is NO WARRANTY.\n");
|
||||||
REG_PIOB_CODR = 1 << 27;
|
printf("See <https://git.fef.moe/fef/ardix> for details.\n\n");
|
||||||
|
|
||||||
while (true) {
|
|
||||||
printf("hello, world (%u)\n", print_count);
|
|
||||||
|
|
||||||
|
/* TODO: The next big step is to write initd and fork to it here. */
|
||||||
|
while (1)
|
||||||
sleep(1000);
|
sleep(1000);
|
||||||
|
|
||||||
print_count++;
|
|
||||||
if (print_count % 2)
|
|
||||||
REG_PIOB_CODR = 1 << 27;
|
|
||||||
else
|
|
||||||
REG_PIOB_SODR = 1 << 27;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
Loading…
Reference in a new issue