Fixed cstartup.s
This commit is contained in:
parent
57ce078167
commit
cc21b3d4bb
|
@ -40,8 +40,7 @@ CFLAGS += --debug \
|
|||
ASFLAGS += --debug
|
||||
endif
|
||||
|
||||
LDFLAGS := --no-data-init-table-section \
|
||||
--rtattr cstartup=sentinel65x \
|
||||
LDFLAGS := --rtattr cstartup=sentinel65x \
|
||||
--verbose \
|
||||
--output-format raw
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
(section data)
|
||||
(section chuge)
|
||||
(section ihuge)
|
||||
(section data_init_table)
|
||||
(section (irq_trampolines #xC0F000))
|
||||
(section (irq_vectors #xC0FF80))
|
||||
)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
.section stack
|
||||
.section cstack
|
||||
.section heap
|
||||
.section data_init_table
|
||||
|
||||
.extern main, exit
|
||||
.extern _Dp, _Vfp
|
||||
|
@ -39,18 +40,61 @@ __program_root_section:
|
|||
txs ; set stack
|
||||
lda ##_DirectPageStart
|
||||
tcd ; set direct page
|
||||
#ifdef __CALYPSI_DATA_MODEL_SMALL__
|
||||
lda ##0
|
||||
#else
|
||||
lda ##.word2 _NearBaseAddress
|
||||
#endif
|
||||
stz dp:.tiny(_Vfp+2)
|
||||
xba ; A upper half = data bank
|
||||
pha
|
||||
plb ; pop 8 dummy
|
||||
plb ; set data bank
|
||||
|
||||
#ifdef __CALYPSI_CODE_MODEL_COMPACT__
|
||||
jmp long:_Trampoline_program_start
|
||||
.section compactcode, noreorder
|
||||
_Trampoline_program_start:
|
||||
#define CODE compactcode
|
||||
#else
|
||||
#define CODE code
|
||||
#endif
|
||||
call __low_level_init
|
||||
|
||||
;;; **** Initialize data sections if needed.
|
||||
.section CODE, noroot, noreorder
|
||||
.pubweak __data_initialization_needed
|
||||
.extern __initialize_sections
|
||||
__data_initialization_needed:
|
||||
lda ##.word2 (.sectionEnd data_init_table)
|
||||
sta dp:.tiny(_Dp+6)
|
||||
lda ##.word0 (.sectionEnd data_init_table)
|
||||
sta dp:.tiny(_Dp+4)
|
||||
lda ##.word2 (.sectionStart data_init_table)
|
||||
sta dp:.tiny(_Dp+2)
|
||||
lda ##.word0 (.sectionStart data_init_table)
|
||||
sta dp:.tiny(_Dp+0)
|
||||
call __initialize_sections
|
||||
|
||||
;;; **** Initialize streams if needed.
|
||||
.section CODE, noroot, noreorder
|
||||
.pubweak __call_initialize_global_streams
|
||||
.extern __initialize_global_streams
|
||||
__call_initialize_global_streams:
|
||||
call __initialize_global_streams
|
||||
|
||||
;;; **** Initialize heap if needed.
|
||||
.section code, noroot, noreorder
|
||||
.section CODE, noroot, noreorder
|
||||
.pubweak __call_heap_initialize
|
||||
.extern __heap_initialize, __default_heap
|
||||
__call_heap_initialize:
|
||||
#ifdef __CALYPSI_DATA_MODEL_SMALL__
|
||||
lda ##.sectionSize heap
|
||||
sta dp:.tiny(_Dp+2)
|
||||
lda ##.sectionStart heap
|
||||
sta dp:.tiny(_Dp+0)
|
||||
lda ##__default_heap
|
||||
#else
|
||||
lda ##.word2 (.sectionStart heap)
|
||||
sta dp:.tiny(_Dp+6)
|
||||
lda ##.word0 (.sectionStart heap)
|
||||
|
@ -61,9 +105,24 @@ __call_heap_initialize:
|
|||
sta dp:.tiny(_Dp+0)
|
||||
ldx ##.word2 (.sectionSize heap)
|
||||
lda ##.word0 (.sectionSize heap)
|
||||
#endif
|
||||
call __heap_initialize
|
||||
|
||||
.section code, root, noreorder
|
||||
.section CODE, root, noreorder
|
||||
lda ##0 ; argc = 0
|
||||
call main
|
||||
jump exit
|
||||
|
||||
;;; ***************************************************************************
|
||||
;;;
|
||||
;;; __low_level_init - custom low level initialization
|
||||
;;;
|
||||
;;; This default routine just returns doing nothing. You can provide your own
|
||||
;;; routine, either in C or assembly for doing custom low leve initialization.
|
||||
;;;
|
||||
;;; ***************************************************************************
|
||||
|
||||
.section libcode
|
||||
.pubweak __low_level_init
|
||||
__low_level_init:
|
||||
return
|
||||
|
|
|
@ -11,11 +11,12 @@
|
|||
|
||||
#include "kernel/device.h"
|
||||
#include "kernel/file.h"
|
||||
#include "kernel/device/null.h"
|
||||
|
||||
static bool device_init_all_run = false;
|
||||
|
||||
Device *device[DEVICE_MAX] = {
|
||||
NULL
|
||||
&NullDevice
|
||||
};
|
||||
|
||||
struct device_map *device_map[DEVICE_MAP_MAX] = {0};
|
||||
|
|
Loading…
Reference in New Issue