it builds!

This commit is contained in:
Aria Nolan 2024-01-27 12:05:34 -05:00
parent 310eb52f0f
commit 66c466f699
5 changed files with 32 additions and 7 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.axf
*.map

19
Makefile Normal file
View file

@ -0,0 +1,19 @@
CC=arm-none-eabi-gcc
ARCH_FLAGS=-mthumb -mcpu=cortex-m0plus
CFLAGS=$(ARCH_FLAGS) -Os -flto -ffunction-sections -fdata-sections -D__STARTUP_COPY_MULTIPLE -D__STARTUP_CLEAR_BSS_MULTIPLE
USE_NANO=--specs=nano.specs
USE_NOHOST=--specs=nosys.specs
# Link for code size
GC=-Wl,--gc-sections
# Create map file
MAP=-Wl,-Map=main.map
LDSCRIPTS=-L. -T multi-ram.ld
main.axf: main.c sysinit.c startup_ARMCM0.s
$(CC) $^ $(CFLAGS) -fno-exceptions $(USE_NANO) $(USE_NOHOST) $(LDSCRIPTS) $(GC) $(MAP) -o $@
clean:
rm -f *.axf *.map

7
main.c Normal file
View file

@ -0,0 +1,7 @@
void main()
{
for (;;);
return;
}

View file

@ -184,6 +184,7 @@ SECTIONS
__bss2_end__ = .; __bss2_end__ = .;
} > RAM2 } > RAM2
/*
.heap (COPY): .heap (COPY):
{ {
__end__ = .; __end__ = .;
@ -191,6 +192,7 @@ SECTIONS
*(.heap*) *(.heap*)
__HeapLimit = .; __HeapLimit = .;
} > RAM } > RAM
*/
/* .stack_dummy section doesn't contains any symbols. It is only /* .stack_dummy section doesn't contains any symbols. It is only
* used for linker to calculate size of stack sections, and assign * used for linker to calculate size of stack sections, and assign
@ -202,7 +204,7 @@ SECTIONS
/* Set stack top to end of RAM, and stack limit move down by /* Set stack top to end of RAM, and stack limit move down by
* size of stack_dummy section */ * size of stack_dummy section */
__StackTop = ORIGIN(RAM) + LENGTH(RAM); __StackTop = ORIGIN(RAM) + 0xFF;
__StackLimit = __StackTop - SIZEOF(.stack_dummy); __StackLimit = __StackTop - SIZEOF(.stack_dummy);
PROVIDE(__stack = __StackTop); PROVIDE(__stack = __StackTop);

View file

@ -30,11 +30,6 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
/* CHANGING DEFINES */
#define __STARTUP_COPY_MULTIPLE
#define __STARTUP_CLEAR_BSS_MULTIPLE
.syntax unified .syntax unified
.arch armv6-m .arch armv6-m
@ -237,7 +232,7 @@ Reset_Handler:
#ifndef __START #ifndef __START
#define __START _start #define __START _start
#endif #endif
bl __START bl _start
.pool .pool
.size Reset_Handler, . - Reset_Handler .size Reset_Handler, . - Reset_Handler