New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further cleaning up code for PT #83

Merged
merged 15 commits into from Jul 7, 2014

Conversation

Projects
None yet
3 participants
@farcaller
Member

farcaller commented Jul 3, 2014

Ok, this is a big one.

  • gdb now exports RUST_BACKTRACE to env to simplify debugging
  • added hamcrest-rust crate to make tests clearer
  • another major refactoring on PT, API is getting stabilised!
    • new attachers, that attach mutating and materialising code to Nodes
    • #[zinc_task] macro, that allows tasks to accept args with type parameters and trait bounds (i.e. static dispatch down to the end!)
    • drivers root node in PT
    • a bit better tests (they still need lots of love)
    • new os.simple_task.args materialiser with support for zinc_task
    • new integration test for lpc17xx that verifies a full lpc17xx PT tree with reasonable defaults
@farcaller

This comment has been minimized.

Member

farcaller commented Jul 5, 2014

Ok, I think this is good now. @bharrisau please take a look when you have time (this code really needs some review).

Also /cc interested parties: @bgamari @ah-

@farcaller

This comment has been minimized.

Member

farcaller commented Jul 5, 2014

Just for an overview, generated PT:

#[allow(non_camel_case_types)]
mod pt {
    use zinc;
    pub struct run_args<'a, Ty7132BDC75526FAD3, Ty328918F1C37C215> {
        pub dht: &'a zinc::drivers::dht22::DHT22<'a,
                     Ty328918F1C37C215, Ty7132BDC75526FAD3>,
        pub timer: &'a zinc::hal::lpc17xx::timer::Timer,
        pub uart: &'a zinc::hal::lpc17xx::uart::UART,
    }
}
#[no_mangle]
#[no_split_stack]
#[allow(unused_variable)]
pub unsafe fn main() {
    zinc::hal::mem_init::init_stack();
    zinc::hal::mem_init::init_data();
    {
        use zinc::hal::lpc17xx::system_clock;
        system_clock::init_clock(&system_clock::Clock{source:
                                                          system_clock::Main(12000000),
                                                      pll:
                                                          core::option::Some(system_clock::PLL0{m:
                                                                                                    50u8,
                                                                                                n:
                                                                                                    3u8,
                                                                                                divisor:
                                                                                                    4u8,}),});
    };
    let timer =
        zinc::hal::lpc17xx::timer::Timer::new(zinc::hal::lpc17xx::timer::Timer1,
                                              25u32, 4u8);
    let uart_tx =
        zinc::hal::lpc17xx::pin::Pin::new(zinc::hal::lpc17xx::pin::Port0, 2u8,
                                          zinc::hal::lpc17xx::pin::AltFunction1,
                                          core::option::None);
    let uart_rx =
        zinc::hal::lpc17xx::pin::Pin::new(zinc::hal::lpc17xx::pin::Port0, 3u8,
                                          zinc::hal::lpc17xx::pin::AltFunction1,
                                          core::option::None);
    let uart =
        zinc::hal::lpc17xx::uart::UART::new(zinc::hal::lpc17xx::uart::UART0,
                                            115200u32, 8u8,
                                            zinc::hal::uart::Disabled, 1u8);
    let dht_pin =
        zinc::hal::lpc17xx::pin::Pin::new(zinc::hal::lpc17xx::pin::Port0, 4u8,
                                          zinc::hal::lpc17xx::pin::GPIO,
                                          core::option::Some(zinc::hal::pin::Out));
    let dht = zinc::drivers::dht22::DHT22::new(&timer, &dht_pin);
    loop  { run(&pt::run_args{dht: &dht, timer: &timer, uart: &uart,}); }
}

generated run:

#[no_split_stack]
fn run<Ty7132BDC75526FAD3: zinc::hal::pin::GPIO,
       Ty328918F1C37C215: zinc::hal::timer::Timer>(args:
                                                       &pt::run_args<Ty7132BDC75526FAD3,
                                                                     Ty328918F1C37C215>) {
    use zinc::drivers::chario::CharIO;
    use zinc::hal::timer::Timer;
    args.timer.wait(3);
    let ret = args.dht.read();
    match ret {
        Some(v) => {
            args.uart.puts("temp:     ");
            args.uart.puti(v.temperature as u32);
            args.uart.puts("\n");
            args.uart.puts("humidity: ");
            args.uart.puti(v.humidity as u32);
            args.uart.puts("\n");
        },
        None => { args.uart.puts("fail\n"); }
    }
}
@farcaller

This comment has been minimized.

Member

farcaller commented Jul 5, 2014

Kind of managed to get coverage working again: http://zinc.rs/cov/platformtree_test/index.html

I think I will be working on our infrastructure tomorrow, having all the stats aggregated in one place is a really good thing.

farcaller added some commits Jun 29, 2014

Big chunk of work on PT
 - gdb now sets RUST_BACKTRACE
 - big refactoring of node::Node
   - submodes are now indexed by order of appearance
   - added materializer / mutator functions
   - added dependency tracking
 - fixes to parser to support all that
 - fixes to all pt code to support dependency-based tree walker
Various cleanig up; trying to fix dht22
This code doesn't work as well, it seems that rungs should be templated based on dht22 'a, S, P.
@farcaller

This comment has been minimized.

Owner

farcaller commented on bfe8605 Jul 7, 2014

r+

@farcaller

This comment has been minimized.

Member

farcaller commented Jul 7, 2014

Ok, no comments, so I'm pushing this forward.

@hacknbot

This comment has been minimized.

Contributor

hacknbot commented on bfe8605 Jul 7, 2014

saw approval from farcaller
at farcaller@bfe8605

This comment has been minimized.

Contributor

hacknbot replied Jul 7, 2014

merging farcaller/zinc/pt-dht22 = bfe8605 into auto

This comment has been minimized.

Contributor

hacknbot replied Jul 7, 2014

farcaller/zinc/pt-dht22 = bfe8605 merged ok, testing candidate = 03e3593

This comment has been minimized.

Contributor

hacknbot replied Jul 7, 2014

This comment has been minimized.

Contributor

hacknbot replied Jul 7, 2014

fast-forwarding master to auto = 03e3593

hacknbot added a commit that referenced this pull request Jul 7, 2014

Merge pull request #83 from farcaller/pt-dht22
Further cleaning up code for PT

Reviewed-by: farcaller

@hacknbot hacknbot merged commit bfe8605 into hackndev:master Jul 7, 2014

2 checks passed

continuous-integration/travis-ci The Travis CI build passed
Details
default all tests passed
Details

@farcaller farcaller deleted the farcaller:pt-dht22 branch Jul 7, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment