Skip to content

Daviddedic2008/Cortex_M4_Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

121 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toy Compiler for Cortex-M4

A lightweight C-based compiler targeting the ARM Cortex-M4 architecture. This project is designed to be efficient enough to eventually run as a self-hosted compiler directly on Cortex-M4 hardware.

Current Status

  • Target: ARM Cortex-M4.
  • Host Build: Windows x64 using GNU GCC.
  • Feature Goal: Self-hosting capabilities and direct flashing to hardware.

Syntax & Docs

  • Read DOCS.md to gain an idea of how the language works.

Project Files

  • main.c
  • compiler.c : Main file
  • src.m4 : Source code file (can be opened with the custom UDL).
  • m4UDL.xml : My language's UDL file for use in notepad++.
  • CMakeLists.txt: Build system configuration.
  • bld.bat: Standard build script.
  • remake.bat: Clean and cache refresh script.
  • compile.bat : Command to compile a text file.

Usage

Build and Run

To compile the compiler on Windows (with GCC in path)

First navigate to the repository

cd %pathToRepo%

Compile compiler :)

bld

To compile a source file

compile %sourcePath%

OR:

%directoryOfCompilerExecutable%/CortexM4Compiler.exe %sourcePath%

API used to compile a string

void assembleSource(const char* sourceString, const uint32_t programOrigin)

Video of LED blink program working!

IMG_3729.mov

About

Simple compiler that targets & runs on the resource constrained Cortex M4. No dependencies required, emits raw binary files. Build/remake scripts included.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors