main: move kernel start routine to kernel/

io-wait
anna 3 years ago
parent 75d2fb4470
commit b7e9187740
Signed by: fef
GPG Key ID: EC22E476DC2D3D84

@ -71,7 +71,7 @@ configure_file(
add_subdirectory(arch)
add_subdirectory(init)
#add_subdirectory(init)
add_subdirectory(kernel)
add_subdirectory(lib)
@ -86,7 +86,7 @@ add_custom_command(
COMMAND ${CMAKE_LINKER}
ARGS ${ARDIX_LINKER_FLAGS} -o ardix.elf
$<TARGET_FILE:ardix_arch>
$<TARGET_FILE:ardix_init>
#$<TARGET_FILE:ardix_init>
$<TARGET_FILE:ardix_kernel>
$<TARGET_FILE:ardix_kernel_fs>
$<TARGET_FILE:ardix_lib>

@ -14,6 +14,7 @@ target_sources(ardix_kernel PRIVATE
io.c
kent.c
kevent.c
main.c
mutex.c
ringbuf.c
sched.c

@ -1,25 +1,17 @@
/* See the end of this file for copyright, license, and warranty information. */
#include <arch/hardware.h>
#include <ardix/io.h>
#include <ardix/kent.h>
#include <ardix/kevent.h>
#include <ardix/sched.h>
#include <config.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.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.
*
@ -28,8 +20,6 @@
*/
int main(void)
{
volatile unsigned int print_count = 0;
int err = kent_root_init();
if (err != 0)
return err;
@ -50,21 +40,13 @@ int main(void)
/* we should have a serial console now */
REG_PIOB_OER = 1 << 27;
REG_PIOB_PER = 1 << 27;
REG_PIOB_CODR = 1 << 27;
while (true) {
printf("hello, world (%u)\n", print_count);
printf("Ardix version " ARDIX_VERSION_STR "\n");
printf("This is non-violent software, and there is NO WARRANTY.\n");
printf("See <https://git.fef.moe/fef/ardix> for details.\n\n");
/* TODO: The next big step is to write initd and fork to it here. */
while (1)
sleep(1000);
print_count++;
if (print_count % 2)
REG_PIOB_CODR = 1 << 27;
else
REG_PIOB_SODR = 1 << 27;
}
}
/*
Loading…
Cancel
Save