indepth debugging added and working

unstable
Penguin 3 years ago
parent 599bcd93f4
commit a20b11b539

@ -0,0 +1,38 @@
q
q
b igloo::main
r
n
q
q
b igloo::main
r
s
s
s
n
n
n
n
n
n
n
n
f
n
finish
r
b 8
n
q
b igloo::main
r
s
n
r
s
s
set listsize 30
s
q
q

@ -2,7 +2,7 @@
name = "igloo"
version = "0.1.0"
authors = ["Penguin <...>"]
edition = "2018"
edition = "2021"
repository = "https://github.com/Embedded-Penguin/ePenguin-igloo/"
readme = "README.md"
description = "Igloo is a package/project manager. It is used for bare metal embedded systems. It is in its early stages of development. The goal of this project is to reduce the pain of writing embedded code by bridging the gap between many different manufacturers. It is can be thought of as glue for many of the fragmented pieces in the embedded world. This is also a learning project for me. Not all of this code will be the most efficient. I wanted to use a problem I saw as an opportunity to learn rust. Advice is welcome."

@ -1,12 +1,11 @@
use clap::ArgMatches;
use crate::IglooType;
use crate::IglooType::*;
use crate::IglooStatus;
use crate::IglooStatus::*;
use crate::IglooType::{self, *};
use crate::IglooStatus::{self, *};
use crate::IglooDebugSeverity::{self, *};
use crate::Igloo;
use crate::igloo_project::IglooProject;
use crate::igloo_util::*;
pub fn igloo_subcommand(args: &ArgMatches) -> Result<IglooType, IglooStatus>
{
@ -15,47 +14,47 @@ pub fn igloo_subcommand(args: &ArgMatches) -> Result<IglooType, IglooStatus>
{
Some("new") =>
{
println!("Igloo new was called!");
igloo_debug!(TRACE, IS_GOOD, "Igloo new was called!");
_res_type = IT_NEW;
}
Some("run") =>
{
println!("Igloo run was called!");
igloo_debug!(TRACE, IS_GOOD, "Igloo run was called!");
_res_type = IT_RUN;
}
Some("build") =>
{
println!("Igloo build was called!");
igloo_debug!(TRACE, IS_GOOD, "Igloo build was called!");
_res_type = IT_BUILD;
}
Some("push") =>
{
println!("Igloo flash was called!");
igloo_debug!(TRACE, IS_GOOD, "Igloo flash was called!");
_res_type = IT_PUSH;
}
Some("pull") =>
{
println!("Igloo pull was called!");
igloo_debug!(TRACE, IS_GOOD, "Igloo pull was called!");
_res_type = IT_PULL;
}
Some("erase") =>
{
println!("Igloo erase was called!");
igloo_debug!(TRACE, IS_GOOD, "Igloo erase was called!");
_res_type = IT_ERASE;
}
Some("info") =>
{
println!("Igloo info was called!");
igloo_debug!(TRACE, IS_GOOD, "Igloo info was called!");
_res_type = IT_INFO;
}
Some("target") =>
{
println!("Igloo target was called");
igloo_debug!(TRACE, IS_GOOD, "Igloo target was called");
_res_type = IT_TARGET;
}
Some("debug") =>
{
println!("Igloo debug was called");
igloo_debug!(TRACE, IS_GOOD, "Igloo debug was called");
_res_type = IT_DEBUG;
}
None => unreachable!(),
@ -102,7 +101,7 @@ pub fn ia_new(igloo: &Igloo, project_name: String, initial_target: String) -> Ig
}
};
prj.add_new_target(initial_target);
prj.add_target_to_config(initial_target);
// Now populate
prj.generate();

@ -19,7 +19,7 @@ use config::Config;
#[derive(Serialize,Deserialize,Debug)]
pub struct IglooTargetManifest
{
targets: HashMap::<String, String>,
pub targets: HashMap::<String, String>,
}

@ -7,24 +7,25 @@ use crate::IglooType::*;
use crate::IglooStatus;
use crate::IglooStatus::*;
use crate::igloo_project;
use crate::igloo_target::IglooTarget;
use serde::{Serialize, Deserialize};
use config::Config;
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Settings
{
testvar: String,
profile: Profile,
pub testvar: String,
pub profile: Profile,
}
/// Basic profile settings
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Profile
{
name: String,
targets: Vec::<String>
pub name: String,
pub targets: Vec::<String>
}
@ -81,12 +82,12 @@ impl Settings
self.profile.targets.push(target_name);
}
pub fn get_targets(project: IglooProject) -> Vec<IglooTarget>
pub fn get_targets_from_config(igloo: &Igloo, config: &Settings) -> Vec<IglooTarget>
{
let _targets: Vec<IglooTarget> = Vec::new();
for target in project.config.profile.targets.iter()
let mut _targets: Vec<IglooTarget> = Vec::new();
for target in config.profile.targets.iter()
{
_targets.push(IglooTarget::from(project.igloo, *target).unwrap());
_targets.push(IglooTarget::target_from_name(igloo, String::from(target)).unwrap());
}
_targets
}
@ -94,9 +95,10 @@ impl Settings
pub struct IglooProject<'a>
{
igloo: &'a Igloo,
config: Settings,
pub igloo: &'a Igloo,
pub config: Settings,
targets: Vec::<IglooTarget>,
pub root: std::path::PathBuf,
}
impl<'a> IglooProject<'a>
@ -108,6 +110,7 @@ impl<'a> IglooProject<'a>
igloo: igloo_in,
config: Settings::default(),
targets: Vec::new(),
root: std::path::PathBuf::new(),
}
}
/// Used to populate an IglooProject from scratch
@ -115,12 +118,13 @@ impl<'a> IglooProject<'a>
pub fn from_new(igloo_in: &'a Igloo, project_name: String) -> Result<IglooProject, IglooStatus>
{
let mut settings = Settings::default();
settings.profile.name = project_name;
settings.profile.name = String::from(&project_name);
Ok(IglooProject
{
igloo: igloo_in,
config: settings,
targets: Vec::new(),
root: igloo_in.env.cwd.join(&project_name),
})
}
@ -129,15 +133,17 @@ impl<'a> IglooProject<'a>
/// igloo run, push, pull, erase, etc... are called
pub fn from_existing(igloo_in: &'a Igloo) -> Result<IglooProject, IglooStatus>
{
let mut ret_project: IglooProject = IglooProject
let _config = Settings::default().from_project_file(igloo_in).unwrap();
let _targets = Settings::get_targets_from_config(igloo_in, &_config);
let _root = igloo_in.env.cwd.join(&_config.profile.name);
let ret_project = IglooProject
{
igloo: igloo_in,
config: Settings::default().from_project_file(igloo_in).unwrap(),
targets: Vec::new(),
config: _config,
targets: _targets,
root: _root,
};
ret_project.targets = crate::igloo_project::Settings::get_targets(ret_project);
Ok(ret_project)
Ok(IglooProject::default(igloo_in))
}
pub fn is_igloo_prj(path: &std::path::PathBuf) -> bool
@ -250,7 +256,7 @@ impl<'a> IglooProject<'a>
fn generate_targets(&self) -> IglooStatus
{
for target in self.targets
for target in &self.targets
{
target.generate(self);
}

@ -7,24 +7,35 @@
// I'm only doing it this way because serialization seems to be easier this way
// After I get all core features (new, push, pull, erase, etc...) completed,
// I'll revisit this part of the project and change it to a more sensible management method
//
// Update to this: The deserialization doesn't even work with the scheme I was using...
// Going back to the old way until I learn more.
// I could make the deserialization work by default by adding a billion different
// structs, but this is honestly just a trash way of doing it and I think the idea
// of doing it that way is only an ideal solution. It isn't very practical.
use crate::Igloo;
use crate::IglooStatus;
use crate::IglooStatus::*;
use crate::IglooProject;
struct IglooTargetLinks
use serde::{Serialize, Deserialize};
use config::Config;
use std::fs::{OpenOptions, File};
use std::vec::Vec;
use std::io::prelude::*;
use std::path::PathBuf;
use std::collections::HashMap;
#[derive(Serialize, Deserialize, Debug)]
pub struct IglooTarget
{
name: String,
common: String,
mcu: String,
ld: String,
cfg: String,
}
pub struct IglooTarget
{
name: String,
links: IglooTargetLinks,
includes: Vec<String>,
scripts: Vec<String>,
series: String,
}
impl IglooTarget
@ -33,19 +44,38 @@ impl IglooTarget
{
IglooTarget
{
name: String::new(),
links: IglooTargetLinks::default(),
name: String::new(),
common: String::new(),
mcu: String::new(),
ld: String::new(),
cfg: String::new(),
includes: Vec::new(),
scripts: Vec::new(),
series: String::new(),
}
}
/// takes the targets name and looks up the path
/// deserializes the targets manifest file and creates the target
pub fn from(igloo: &Igloo, name: String) -> Result<IglooTarget, IglooStatus>
pub fn target_from_name(igloo: &Igloo, name: String) -> Result<IglooTarget, IglooStatus>
{
let target_path = &igloo.master_target_manifest.targets[&name];
let mut target_config = config::Config::default();
target_config.merge(
config::File::with_name(
igloo.env
.esfd
.clone()
.join(&target_path)
.to_str().unwrap()
)).unwrap();
Ok(IglooTarget::default())
let mut target_table: config::Value = target_config.get("esf").unwrap();
let ret_target = target_table.try_into::<IglooTarget>().unwrap();
println!("{:?}", ret_target);
Ok(ret_target)
}
/// Creates the target's configuration file from itself
@ -57,25 +87,740 @@ impl IglooTarget
ret
}
/*
pub fn generate_makefile(&self, project: &IglooProject) -> IglooStatus
{
let mut ret = IS_GOOD;
let prj_root =
let target_root = project.root.join(self.name);
// If the Makefile already exists, trash it
if target_root.join("Makefile").exists()
{
std::fs::remove_file(target_root.join("Makefile")).unwrap();
}
ret
}
}
// Make our Makefile, set it to append mode
std::fs::File::create(target_root.join("Makefile")).unwrap();
let mut app_file = OpenOptions::new()
.write(true)
.append(true)
.open(target_root.join("Makefile"))
.unwrap();
//
writeln!(app_file, "# ePenguin Generated Variables").unwrap();
writeln!(app_file, "PROJECT_NAME={}", project.config.profile.name).unwrap();
writeln!(app_file, "TARGET_NAME={}", self.name).unwrap();
impl IglooTargetLinks
{
pub fn default() -> IglooTargetLinks
{
IglooTargetLinks
let makefile: HashMap<String, config::Value> = HashMap::new();
match project.igloo.master_make_manifest.get("TOOLCHAIN")
{
common: String::new(),
mcu: String::new(),
ld: String::new(),
cfg: String::new(),
None =>
{
println!("TOOLCHAIN Not found");
}
Some(v) =>
{
write!(app_file, "TOOLCHAIN=").unwrap();
writeln!(app_file, "{}", v.to_string()).unwrap();
},
}
match project.igloo.master_make_manifest.get("CC")
{
None =>
{
println!("CC Not found");
}
Some(v) =>
{
write!(app_file, "CC=").unwrap();
writeln!(app_file, "{}", v.to_string()).unwrap();
},
}
match project.igloo.master_make_manifest.get("CXX")
{
None =>
{
println!("CXX Not found");
}
Some(v) =>
{
write!(app_file, "CXX=").unwrap();
writeln!(app_file, "{}", v.to_string()).unwrap();
},
}
match project.igloo.master_make_manifest.get("OBJCOPY")
{
None =>
{
println!("OBJCOPY Not found");
}
Some(v) =>
{
write!(app_file, "OBJCOPY=").unwrap();
writeln!(app_file, "{}", v.to_string()).unwrap();
},
}
match project.igloo.master_make_manifest.get("OBJDUMP")
{
None =>
{
println!("OBJDUMP Not found");
}
Some(v) =>
{
write!(app_file, "OBJDUMP=").unwrap();
writeln!(app_file, "{}", v.to_string()).unwrap();
},
}
match project.igloo.master_make_manifest.get("GDB")
{
None =>
{
println!("GDB Not found");
}
Some(v) =>
{
write!(app_file, "GDB=").unwrap();
writeln!(app_file, "{}", v.to_string()).unwrap();
},
}
match project.igloo.master_make_manifest.get("SIZE")
{
None =>
{
println!("SIZE Not found");
}
Some(v) =>
{
write!(app_file, "SIZE=").unwrap();
writeln!(app_file, "{}", v.to_string()).unwrap();
},
}
match project.igloo.master_make_manifest.get("AS")
{
None =>
{
println!("AS Not found");
}
Some(v) =>
{
write!(app_file, "AS=").unwrap();
writeln!(app_file, "{}", v.to_string()).unwrap();
},
}
writeln!(app_file, "\n").unwrap();
// MCU Specifics now
match project.igloo.master_make_manifest.get("MCPU")
{
None =>
{
println!("MCPU Not found");
}
Some(v) =>
{
write!(app_file, "MCPU=").unwrap();
writeln!(app_file, "{}", v.to_string()).unwrap();
},
}
match project.igloo.master_make_manifest.get("MCU")
{
None =>
{
println!("MCU Not found");
}
Some(v) =>
{
write!(app_file, "MCU=").unwrap();
writeln!(app_file, "{}", v.to_string()).unwrap();
},
}
match project.igloo.master_make_manifest.get("LD_PATH")
{
None =>
{
println!("LD_PATH Not found");
}
Some(v) =>
{
write!(app_file, "LD_PATH=").unwrap();
writeln!(app_file, "{}", v.to_string()).unwrap();
},
}
match project.igloo.master_make_manifest.get("LD_SCRIPT")
{
None =>
{
println!("LD_SCRIPT Not found");
}
Some(v) =>
{
write!(app_file, "LD_SCRIPT=").unwrap();
writeln!(app_file, "{}", v.to_string()).unwrap();
},
}
writeln!(app_file, "\n").unwrap();
// CFLAGS
match project.igloo.master_make_manifest.get("CFLAGS")
{
None =>
{
println!("CFLAGS Not found");
}
Some(v) =>
{
write!(app_file, "CFLAGS=").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, " \\").unwrap();
write!(app_file, "{}", cflag).unwrap();
}
},
}
writeln!(app_file, "\n").unwrap();
// ELF FLAGS
match project.igloo.master_make_manifest.get("ELF_FLAGS")
{
None =>
{
println!("ELF_FLAGS Not found");
}
Some(v) =>
{
write!(app_file, "ELF_FLAGS=").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, " \\").unwrap();
write!(app_file, "{}", cflag).unwrap();
}
},
}
writeln!(app_file, "\n").unwrap();
// HEX FLAGS
match project.igloo.master_make_manifest.get("HEX_FLAGS")
{
None =>
{
println!("HEX_FLAGS Not found");
}
Some(v) =>
{
write!(app_file, "HEX_FLAGS=").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, " \\").unwrap();
write!(app_file, "{}", cflag).unwrap();
}
},
}
writeln!(app_file, "\n").unwrap();
match project.igloo.master_make_manifest.get("EEP_FLAGS")
{
None =>
{
println!("EEP_FLAGS Not found");
}
Some(v) =>
{
write!(app_file, "EEP_FLAGS=").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, " \\").unwrap();
write!(app_file, "{}", cflag).unwrap();
}
},
}
writeln!(app_file, "\n").unwrap();
// Write SystemRoot config stuff for cross compatibility
let sysroot: String = String::from("
ifdef SystemRoot
SHELL = cmd.exe
MK_DIR = mkdir
else
ifeq ($(shell uname), Linux)
MK_DIR = mkdir -p
endif
ifeq ($(shell uname | cut -d _ -f 1), CYGWIN)
MK_DIR = mkdir -p
endif
ifeq ($(shell uname | cut -d _ -f 1), MINGW32)
MK_DIR = mkdir -p
endif
ifeq ($(shell uname | cut -d _ -f 1), MINGW64)
MK_DIR = mkdir -p
endif
ifeq ($(shell uname | cut -d _ -f 1), DARWIN)
MK_DIR = mkdir -p
endif
endif");
writeln!(app_file, "{}", sysroot).unwrap();
match project.igloo.master_make_manifest.get("SUB_DIRS")
{
None =>
{
println!("SUB_DIRS Not found");
}
Some(v) =>
{
write!(app_file, "SUB_DIRS+=").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, " \\").unwrap();
write!(app_file, "{}", cflag).unwrap();
}
},
}
writeln!(app_file, "\n").unwrap();
match project.igloo.master_make_manifest.get("OBJS")
{
None =>
{
println!("OBJS Not found");
}
Some(v) =>
{
write!(app_file, "OBJS+=").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, " \\").unwrap();
write!(app_file, "{}", cflag).unwrap();
}
},
}
writeln!(app_file, "\n").unwrap();
match project.igloo.master_make_manifest.get("OBJS_AS_ARGS")
{
None =>
{
println!("OBJS_AS_ARGS Not found");
}
Some(v) =>
{
write!(app_file, "OBJS_AS_ARGS+=").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, " \\").unwrap();
write!(app_file, "{}", cflag).unwrap();
}
},
}
writeln!(app_file, "\n").unwrap();
match project.igloo.master_make_manifest.get("DIR_INCLUDES")
{
None =>
{
println!("DIR_INCLUDES Not found");
}
Some(v) =>
{
write!(app_file, "DIR_INCLUDES+=").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, " \\").unwrap();
write!(app_file, "{}", cflag).unwrap();
}
},
}
write!(app_file, "\n\n").unwrap();
match project.igloo.master_make_manifest.get("DEPS")
{
None =>
{
println!("DEPS Not found");
}
Some(v) =>
{
write!(app_file, "DEPS:=").unwrap();
writeln!(app_file, "{}", v.to_string()).unwrap();
},
}
write!(app_file, "\n").unwrap();
match project.igloo.master_make_manifest.get("DEPS_AS_ARGS")
{
None =>
{
println!("DEPS_AS_ARGS Not found");
}
Some(v) =>
{
write!(app_file, "DEPS_AS_ARGS:=").unwrap();
writeln!(app_file, "{}", v.to_string()).unwrap();
},
}
writeln!(app_file, "\nvpath %.c ../../../").unwrap();
writeln!(app_file, "vpath %.s ../../../").unwrap();
writeln!(app_file, "vpath %.S ../../../\n").unwrap();
writeln!(app_file, ".PHONY: debug clean\n").unwrap();
match project.igloo.master_make_manifest.get("ALL_PREREQS")
{
None =>
{
println!("ALL_PREREQS Not found");
}
Some(v) =>
{
write!(app_file, "all:").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, "\\").unwrap();
write!(app_file, "{}", cflag).unwrap();
}
},
}
match project.igloo.master_make_manifest.get("ALL_CMDS")
{
None =>
{
println!("ALL_CMDS Not found");
}
Some(v) =>
{
write!(app_file, "\n").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, "\t{}", cflag).unwrap();
}
},
}
write!(app_file, "\n\n").unwrap();
match project.igloo.master_make_manifest.get("ELF_TARGET_PREREQS")
{
None =>
{
println!("ELF_TARGET_PREREQS Not found");
}
Some(v) =>
{
write!(app_file, "$(PROJECT_NAME).elf:").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, "\\").unwrap();
write!(app_file, "{}", cflag).unwrap();
}
},
}
match project.igloo.master_make_manifest.get("ELF_TARGET_CMDS")
{
None =>
{
println!("ELF_TARGET_CMDS Not found");
}
Some(v) =>
{
write!(app_file, "\n").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, "\t{}", cflag).unwrap();
}
},
}
write!(app_file, "\n\n").unwrap();
match project.igloo.master_make_manifest.get("BIN_TARGET_PREREQS")
{
None =>
{
println!("BIN_TARGET_PREREQS Not found");
}
Some(v) =>
{
write!(app_file, "$(PROJECT_NAME).bin:").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, "\\").unwrap();
write!(app_file, "{}", cflag).unwrap();
}
},
}
match project.igloo.master_make_manifest.get("BIN_TARGET_CMDS")
{
None =>
{
println!("BIN_TARGET_CMDS Not found");
}
Some(v) =>
{
write!(app_file, "\n").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, "\t{}", cflag).unwrap();
}
},
}
write!(app_file, "\n\n").unwrap();
match project.igloo.master_make_manifest.get("HEX_TARGET_PREREQS")
{
None =>
{
println!("HEX_TARGET_PREREQS Not found");
}
Some(v) =>
{
write!(app_file, "$(PROJECT_NAME).hex:").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, "\\").unwrap();
write!(app_file, "{}", cflag).unwrap();
}
},
}
match project.igloo.master_make_manifest.get("HEX_TARGET_CMDS")
{
None =>
{
println!("HEX_TARGET_CMDS Not found");
}
Some(v) =>
{
write!(app_file, "\n").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, "\t{}", cflag).unwrap();
}
},
}
write!(app_file, "\n\n").unwrap();
match project.igloo.master_make_manifest.get("EEP_TARGET_PREREQS")
{
None =>
{
println!("EEP_TARGET_PREREQS Not found");
}
Some(v) =>
{
write!(app_file, "$(PROJECT_NAME).eep:").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, "\\").unwrap();
write!(app_file, "{}", cflag).unwrap();
}
},
}
match project.igloo.master_make_manifest.get("EEP_TARGET_CMDS")
{
None =>
{
println!("EEP_TARGET_CMDS Not found");
}
Some(v) =>
{
write!(app_file, "\n").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, "\t{}", cflag).unwrap();
}
},
}
write!(app_file, "\n\n").unwrap();
match project.igloo.master_make_manifest.get("LSS_TARGET_PREREQS")
{
None =>
{
println!("LSS_TARGET_PREREQS Not found");
}
Some(v) =>
{
write!(app_file, "$(PROJECT_NAME).lss:").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, "\\").unwrap();
write!(app_file, "{}", cflag).unwrap();
}
},
}
match project.igloo.master_make_manifest.get("LSS_TARGET_CMDS")
{
None =>
{
println!("LSS_TARGET_CMDS Not found");
}
Some(v) =>
{
write!(app_file, "\n").unwrap();
for cflag in v.clone().into_array().unwrap()
{
writeln!(app_file, "\t{}", cflag).unwrap();
}
},
}
// Compiler Targets
writeln!(app_file, "").unwrap();
writeln!(app_file, "
# Compiler targets
%.o: %.c
@echo Building file: $<
@echo ARM/GNU C Compiler
$(QUOTE)$(CC)$(QUOTE) $(CFLAGS) -o $(QUOTE)$@$(QUOTE) $(QUOTE)$<$(QUOTE)
@echo Finished building: $<").unwrap();
writeln!(app_file, "
%.o: %.s
@echo Building file: $<
@echo ARM/GNU Assembler
$(QUOTE)$(AS)$(QUOTE) $(CFLAGS) -o $(QUOTE)$@$(QUOTE) $(QUOTE)$<$(QUOTE)
@echo Finished building: $<").unwrap();
writeln!(app_file, "
%.o: %.S
@echo Building file: $<
@echo ARM/GNU Preprocessing Assembler
$(QUOTE)$(CC)$(QUOTE) $(CFLAGS) -o $(QUOTE)$@$(QUOTE) $(QUOTE)$<$(QUOTE)
@echo Finished building: $<").unwrap();
writeln!(app_file, "\n").unwrap();
writeln!(app_file, "$(SUB_DIRS):\n\t$(MK_DIR) $(QUOTE)$@$(QUOTE)").unwrap();
writeln!(app_file, "
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(DEPS)),)
-include $(DEPS)
endif
endif\n").unwrap();
match project.igloo.master_make_manifest.get("CLEAN_PREREQS")
{
None =>
{
println!("CLEAN_TARGET_PREREQS Not found");
}
Some(v) =>
{
write!(app_file, "clean:").unwrap();
for cflag in v.clone().into_array().unwrap()
{
if !cflag.to_string().is_empty()
{
writeln!(app_file, "\\").unwrap();
write!(app_file, "{}", cflag).unwrap()
}
}
},
}
match project.igloo.master_make_manifest.get("CLEAN_CMDS")
{
None =>
{
println!("CLEAN_CMDS Not found");
}
Some(v) =>
{
write!(app_file, "\n").unwrap();
for cflag in v.clone().into_array().unwrap()
{
if !cflag.to_string().is_empty()
{
writeln!(app_file, "\t{}", cflag).unwrap()
}
}
},
}
writeln!(app_file, "\n").unwrap();
match project.igloo.master_make_manifest.get("DEBUG_PREREQS")
{
None =>
{
println!("DEBUG_PREREQS Not found");
}
Some(v) =>
{
write!(app_file, "debug:").unwrap();
for cflag in v.clone().into_array().unwrap()
{
if !cflag.to_string().is_empty()
{
writeln!(app_file, "\\").unwrap();
write!(app_file, "{}", cflag).unwrap()
}
}
},
}
match project.igloo.master_make_manifest.get("DEBUG_CMDS")
{
None =>
{
println!("DEBUG_CMDS Not found");
}
Some(v) =>
{
write!(app_file, "\n").unwrap();
for cflag in v.clone().into_array().unwrap()
{
if !cflag.to_string().is_empty()
{
writeln!(app_file, "\t{}", cflag).unwrap()
}
}
},
}
writeln!(app_file, "\n").unwrap();
match project.igloo.master_make_manifest.get("PUSH_PREREQS")
{
None =>
{
println!("PUSH_PREREQS Not found");
}
Some(v) =>
{
write!(app_file, "push:").unwrap();
for cflag in v.clone().into_array().unwrap()
{
if !cflag.to_string().is_empty()
{
writeln!(app_file, "\\").unwrap();
write!(app_file, "{}", cflag).unwrap()
}
}
},
}
match project.igloo.master_make_manifest.get("PUSH_CMDS")
{
None =>
{
println!("PUSH_CMDS Not found");
}
Some(v) =>
{
write!(app_file, "\n").unwrap();
for cflag in v.clone().into_array().unwrap()
{
if !cflag.to_string().is_empty()
{
writeln!(app_file, "\t{}", cflag).unwrap()
}
}
},
}
writeln!(app_file, "\n\nQUOTE:=\"").unwrap();
IS_GOOD
}
*/
}

@ -0,0 +1,35 @@
use crate::IglooStatus::{self, *};
use crate::IglooType::{self, *};
use crate::IglooDebugSeverity::{self, *};
pub static TRACE_LEVEL: IglooDebugSeverity = TRACE;
macro_rules! igloo_debug
{
($severity:expr, $status:expr) =>
{
if TRACE_LEVEL.clone() as u8 <= $severity as u8
{
println!("[{:?}]: Line {:?} in {:?} | {:?}",
$severity,
line!(),
file!(),
$status);
}
};
($severity:expr, $status:expr, $($message:tt)*) =>
{
if TRACE_LEVEL.clone() as u8 <= $severity as u8
{
println!("[{:?}]: Line {:?} in {:?} | {:?} -- {}",
$severity,
line!(),
file!(),
$status,
format_args!($($message)*)
);
}
};
}
pub(crate) use igloo_debug;

@ -15,12 +15,13 @@ mod igloo_project;
mod igloo_manifest;
mod igloo_cli;
mod igloo_env;
mod igloo_util;
use igloo_cli::IglooCliInfo;
use igloo_env::IglooEnv;
use igloo_project::IglooProject;
use igloo_manifest::IglooTargetManifest;
use igloo_util::*;
#[derive(Debug)]
#[derive(PartialEq)]
pub enum IglooType
@ -38,8 +39,7 @@ pub enum IglooType
IT_DEBUG,
}
#[derive(Debug)]
#[derive(PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub enum IglooDebugSeverity
{
CRITICAL = 0,
@ -60,18 +60,19 @@ pub enum IglooStatus
use IglooStatus::*;
use IglooType::*;
use IglooDebugSeverity::*;
pub struct Igloo
{
master_target_manifest: IglooTargetManifest,
master_make_manifest: Config,
cli_info: IglooCliInfo,
env: IglooEnv,
pub master_target_manifest: IglooTargetManifest,
pub master_make_manifest: Config,
pub cli_info: IglooCliInfo,
pub env: IglooEnv,
}
impl Igloo
{
pub fn new() -> Self
pub fn new() -> Igloo
{
Igloo
{
@ -89,6 +90,9 @@ impl Igloo
// get master target manifest
self.master_target_manifest = IglooTargetManifest::get(self).unwrap();
igloo_debug!(TRACE, IS_GOOD, "Hello \n{:?}", self.master_target_manifest);
igloo_debug!(TRACE, IS_GOOD, "TEST");
// get master make manifest
// this is a hacky way of doing it until
// i can figure out a proper structure for deserializing
@ -151,6 +155,10 @@ impl Igloo
IT_NULL =>
{
}
IT_DEBUG =>
{
}
}
res_err

@ -1,17 +1,17 @@
[esf.links]
name = "${TARGET}"
[esf]
common = "arch/arm/common"
mcu = "arch/arm/SAMD21/SAMD21A/mcu"
ld = "arch/arm/SAMD21/SAMD21A/ld"
cfg = "arch/arm/SAMD21/SAMD21A/manifest"
[esf.includes]
IGLOO_INCLUDES = ["sam.h"]
includes = ["sam.h"]
# These are defaults. Once a project is generated, the .cfg can be freely edited without fear of anything being overwritten. However, I do not recommend editing any of the _cfg variables.
[esf.scripts]
scripts = ["arch/arm/SAMD21/SAMD21A/scripts/${TARGET}.cfg", "scripts"]
# lineage for this family of mcus
# this is used to evaluate makefile requirements for mcus
# this will be evaluated to "arch.arm.samd21a.<mcu_name>
[esf.make]
series = "arch.arm.samd21a.${TARGET}"
[user]
# Add user config options here

Loading…
Cancel
Save