From fc38850d650ffd82af40093c6fb506404aade01b Mon Sep 17 00:00:00 2001 From: Penguin Date: Sun, 20 Feb 2022 17:05:09 -0600 Subject: [PATCH] converting igloo to a tool to work with other frameworks. abandoning esf --- README.md | 71 +++++++++++++++++----------------- igloo_core/src/.#lib.rs | 1 + igloo_core/src/igloo_action.rs | 40 ++++++++++++++++--- igloo_core/src/igloo_cli.rs | 2 + igloo_core/src/lib.rs | 4 ++ igloo_util/src/lib.rs | 4 +- 6 files changed, 79 insertions(+), 43 deletions(-) create mode 120000 igloo_core/src/.#lib.rs diff --git a/README.md b/README.md index 3eba879..3bc1009 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,37 @@ # ePenguin-Igloo -### What is Igloo? - -Igloo is a package and project manager. It is used for bare metal (for now only bare metal) embedded systems. In the embedded world, there is a big gap between how one would write code for embedded systems between manufacturers. As of today, 7/2/20, there is really no easy way to go about writing code for any embedded system from scratch. Most of the time, you need to download headers from some unknown location, figure out your hardware interface, find the proper toolchain, etc. This forces embedded developers and engineers to spend a lot of unnecessary time on DevOps and less time on firmware engineering. Igloo aims to solve this problem. Igloo is in its early stages of development. - -### How does Igloo help with this problem? - -This tool allows you to create projects for supported mcus instantly. As long as your hardware is supported, Igloo will just make the project for you. It also allows you to add pre-written software modules, just in case you don't want to write your own. This tool also provides a way to debug your code, flash your mcu, and quickly switch between mcus. - -### Status Guide -| Icon | Description | -| --- | --- | -| :grey_exclamation: | Not supported | -| :exclamation: | In Development | -| :grey_question: | Unstable | -| :question: | Experimental | -| :heavy_check_mark: | Tentatively Working | -| :white_check_mark: | Stable | - -##### Status Guide Description - - Not Supported: This means it is not currently supported. It does not mean it will never be supported. - - In Development: Yet to be released for use at all. We're working on it. - - Unstable: A version of this is out for public development, but it doesn't work yet. - - Experimental: A version of this is out for public developement and testing. It may or may not work. - - Tentatively Working: Some form of this works. It just may not be working in the right way yet. - - Stable: This works as far as we know. Any bugs are minor and should not interfere with use. -### Supported Platforms - -| Platform | Status | -| --- | --- | -| Windows | :exclamation: | -| Linux | :exclamation: | -| MacOS | :exclamation: | -### Installation -- TBD -### Usage -- TBklfjdslkfjlksdjflksdjflkjfi -### How to contribute -- TBD -fhdhejslenfghuyehggjhk +## What is Igloo? + +Igloo was a full on project and package manager. It is no longer that. Igloo is a tool for creating and maintaining projects. It can create bare metal projects (with no framework), and it can also convert and work with ASF4 (Atmel Start) projects. + +Microchip may decide to one day kill atmel start so this project may one day be useless. + +## Why does this exist? + +I use vim and emacs (on and off) as my text editor. I do not use an IDE. + +It aims solves a few problems: + - Regenerating atmel start projects after recustomizing the board settings via the web configurator should be as simple as one command. It shouldn't be a whole ordeal where if you regenerate your project you have to re-move your source files back into the new generated project. + - Compiling, executing, and debugging your code should be more streamlined than opening a bunch of terminals that just sit idling. + - Adding source files to your makefile should be as simple as a command or two. Same with include directories and other configurations. + - Automate other miscellaneous operations. + + +## Prerequisites and Assumptions + +I'm going to assume you know how to get your desired toolchain. It is a prerequisite. + + - [https://github.com/rizsotto/Bear](bear) (OPTIONAL) + - [https://github.com/openocd-org/openocd.git](openocd) + - [https://www.rust-lang.org/tools/install](rust) + +These things can also be installed by your package manager if you want to install a binary instead of building from source. I'll update the instructions for different distros at some point. + + +## Usage + +## Installation + +``` + +``` diff --git a/igloo_core/src/.#lib.rs b/igloo_core/src/.#lib.rs new file mode 120000 index 0000000..c173abb --- /dev/null +++ b/igloo_core/src/.#lib.rs @@ -0,0 +1 @@ +penguin@gpenguin.4155:1645322156 \ No newline at end of file diff --git a/igloo_core/src/igloo_action.rs b/igloo_core/src/igloo_action.rs index 1915d35..fa3d803 100644 --- a/igloo_core/src/igloo_action.rs +++ b/igloo_core/src/igloo_action.rs @@ -60,6 +60,11 @@ pub fn igloo_subcommand(args: &ArgMatches) -> Result igloo_debug!(TRACE, IS_NONE, "Igloo debug was called"); _res_type = IT_DEBUG; } + Some("configure") => + { + igloo_debug!(TRACE, IS_NONE, "Igloo configure was called"); + _res_type = IT_CONFIGURE; + } None => unreachable!(), _ => unreachable!(), } @@ -145,7 +150,7 @@ pub fn ia_build(igloo: &Igloo) -> IglooStatus let mut prj = match IglooProject::from_existing(&igloo) { Ok(v) => v, - Err(e) => + Err(e) => { ret = e; break; @@ -154,9 +159,6 @@ pub fn ia_build(igloo: &Igloo) -> IglooStatus - - - break;} if ret != IS_GOOD @@ -166,10 +168,36 @@ pub fn ia_build(igloo: &Igloo) -> IglooStatus ret } -/// Debugging function to make sure projects are being loaded correctly -pub fn ia_debug(igloo: &Igloo) -> IglooStatus +/// Reconfiguration function +pub fn ia_configure(igloo: &Igloo) -> IglooStatus { let mut ret: IglooStatus = IS_GOOD; + loop + { + if !IglooProject::is_igloo_prj(&igloo.env.cwd) + { + ret = IS_NOT_IGLOO_DIRECTORY; + break; + } + + let mut prj = match IglooProject::from_existing(&igloo) + { + Ok(v) => v, + Err(e) => + { + ret = e; + break; + }, + }; + + // start with profile + + // check targets exist + // check if makefile needs regenerating + + + break;} + ret } diff --git a/igloo_core/src/igloo_cli.rs b/igloo_core/src/igloo_cli.rs index afbf9bf..e456caf 100644 --- a/igloo_core/src/igloo_cli.rs +++ b/igloo_core/src/igloo_cli.rs @@ -94,6 +94,8 @@ fn igloo_run_cli() -> clap::ArgMatches .arg(Arg::new("target_name") .required(true) .about("name of the target to be removed")))) + .subcommand(App::new("configure") + .about("Reconfigures project")) .subcommand(App::new("info") .about("Provides info about various parts of igloo") .subcommand(App::new("list") diff --git a/igloo_core/src/lib.rs b/igloo_core/src/lib.rs index dbd196a..55c3698 100644 --- a/igloo_core/src/lib.rs +++ b/igloo_core/src/lib.rs @@ -135,6 +135,10 @@ impl Igloo { } + IT_CONFIGURE => + { + res_err = igloo_action::ia_configure(self); + } } if res_err != IS_GOOD diff --git a/igloo_util/src/lib.rs b/igloo_util/src/lib.rs index 0db0897..5df20b2 100644 --- a/igloo_util/src/lib.rs +++ b/igloo_util/src/lib.rs @@ -22,9 +22,11 @@ mod tests { /// * IT_INFO: Gets information about igloo and your project. /// * IT_NULL: Default type... used for debugging and development. More on this later /// * IT_DEBUG: this state is useful for debugging project failures. Only to be used in debug build of igloo. More on this later +/// * IT_CONFIGURE: checks config files, parses them for errors, and updates projects with changes pub enum IglooType { IT_NEW = 0, + IT_INIT, IT_RUN, IT_PUSH, IT_PULL, @@ -34,7 +36,7 @@ pub enum IglooType IT_INFO, IT_TARGET, IT_NULL, - IT_DEBUG, + IT_CONFIGURE, } #[derive(Debug, PartialEq, Clone)]