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

Freescale Kinetis K20 #87

Merged
merged 23 commits into from Jul 7, 2014

Conversation

Projects
None yet
4 participants
@bgamari
Contributor

bgamari commented Jul 4, 2014

This is my reorganized and rebased K20 work which still has yet to be tested. Unfortunately many of the K20's peripherals are hold-overs from the 8-bit days, so I've had to generalize the ioreg macros to work over arbitrary register types. Otherwise the changes are pretty straightforward.

Again, this is untested but I thought it would be a good idea to at least advertise that the code exists.

@bgamari

This comment has been minimized.

Contributor

bgamari commented Jul 4, 2014

I should note that where possible I've folded in Ben Harris's code, so in principle this branch should be at least as capable as his.

@bgamari

This comment has been minimized.

Contributor

bgamari commented Jul 4, 2014

@teachop, you may be interested in this.

@@ -0,0 +1,190 @@
// Zinc, the bare metal stack for rust.
// Copyright 2014 Ben Harris <mail@bharr.is>

This comment has been minimized.

@farcaller

farcaller Jul 4, 2014

Member

Please fix here and other files. You must "own" any file you created in the tree (that actually makes sense for me, e.g. in an unlikely case when I would decide to change the license, I will have to contact all the contributors). In case if your file is mostly (> 90%) based on other file, you can mention the original author on the next line (like that is gone in linux kernel for example)

PullDown = 2,
}
pub enum DriveStrength {

This comment has been minimized.

@farcaller

farcaller Jul 4, 2014

Member

Public enum should have doc comment.

}
impl Pin {
pub fn new(port: Port, pin_index: u8, function: Function,

This comment has been minimized.

@farcaller

farcaller Jul 4, 2014

Member

u8, function -- double space.

This comment has been minimized.

@bgamari

bgamari Jul 4, 2014

Contributor

Arg, silly typomatic rate.

use lib::volatile_cell::VolatileCell;
#[allow(uppercase_variables)]
pub struct PORT {

This comment has been minimized.

@farcaller

farcaller Jul 4, 2014

Member

Can you re-write this with ioreg! using one value field? This would keep it in line with other registers and it will be simpler to refactor all that once we roll out better ioreg macro.

struct SIM {
SOPT1: VolatileCell<u32>,
SOPT1CFG: VolatileCell<u32>,
_pad0: [VolatileCell<u32>, ..(0x1004 - 0x8) / 4],

This comment has been minimized.

@farcaller

farcaller Jul 4, 2014

Member

oh well. this is would a bug filed for ioreg :)

#[no_split_stack]
fn uart_clock(&self) -> u32 {
48000000 // FIXME

This comment has been minimized.

@farcaller

farcaller Jul 4, 2014

Member

Please take "ownership" of the FIXME: // FIXME(bgamari): use system clock

}
}
static S1TDREmpty: u8 = 0b1000_0000;

This comment has been minimized.

@farcaller

farcaller Jul 4, 2014

Member

Might be worth moving this down to mod reg, it's quite unexpected in here.

This comment has been minimized.

@bgamari

bgamari Jul 4, 2014

Contributor

Sure, I can provide a patch doing the same for lpc17xx as well in that case.

This comment has been minimized.

@farcaller

farcaller Jul 4, 2014

Member

Yes, that would be nice :-)

reg_r!( UART, u8, TCFIFO, TCFIFO)
reg_rw!(UART, u8, RWFIFO, set_RWFIFO, RWFIFO)
reg_r!( UART, u8, RCFIFO, RCFIFO)
// FIXME: Specialized registers omitted

This comment has been minimized.

@farcaller

farcaller Jul 4, 2014

Member

ditto.

@farcaller

This comment has been minimized.

Member

farcaller commented Jul 4, 2014

I might find some time to work on newer/better ioreg this weekend, but I'm ok with merging the updated version for now. We will add this to travis as soon as it's capable of running app_empty and app_blink.

@bgamari

This comment has been minimized.

Contributor

bgamari commented Jul 4, 2014

@farcaller, a newer ioreg would be great as this is definitely one of the larger useability issues at the moment.

@bgamari

This comment has been minimized.

Contributor

bgamari commented Jul 4, 2014

I finally have blink working on my end.

@farcaller

This comment has been minimized.

Member

farcaller commented Jul 5, 2014

Ok, please update for travis:

  • add PLATFORM=k20 to matrix
  • update the Rakefile to look like:
desc "Build all applications"
case ENV['PLATFORM']
when 'k20'
  task :build_all => [:build_empty, :build_blink_k20]
else
  task :build_all => [:build_empty, :build_blink, :build_uart]
end

Let's see if it WAI.

@errordeveloper

This comment has been minimized.

Member

errordeveloper commented Jul 6, 2014

I actually have a K25Z... Might have a crack at it.

@farcaller

This comment has been minimized.

Member

farcaller commented Jul 7, 2014

build_empty is apparently broken for k20. Please set it to build only build_blink_k20 and remove it from allowed failures. I'm going to merge this.

@bgamari

This comment has been minimized.

Contributor

bgamari commented Jul 7, 2014

Things look good on Travis. Merge when ready.

@farcaller

This comment has been minimized.

Member

farcaller commented Jul 7, 2014

Great job, thanks a lot!

@farcaller

This comment has been minimized.

farcaller commented on afdc80e Jul 7, 2014

r+

@hacknbot

This comment has been minimized.

Contributor

hacknbot commented on afdc80e Jul 7, 2014

saw approval from farcaller
at bgamari@afdc80e

This comment has been minimized.

Contributor

hacknbot replied Jul 7, 2014

merging bgamari/zinc/k20-simple = afdc80e into auto

This comment has been minimized.

Contributor

hacknbot replied Jul 7, 2014

bgamari/zinc/k20-simple = afdc80e merged ok, testing candidate = 6fcef28

This comment has been minimized.

Contributor

hacknbot replied Jul 7, 2014

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

Merge pull request #87 from bgamari/k20-simple
[WIP] Freescale Kinetis K20

Reviewed-by: farcaller

@bgamari bgamari changed the title from [WIP] Freescale Kinetis K20 to Freescale Kinetis K20 Jul 7, 2014

@farcaller

This comment has been minimized.

Member

farcaller commented Jul 7, 2014

Ok, this is beyond broken, I don't know how to force bors to re-test this. Whatever.

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

Merge pull request #87 from bgamari/k20-simple
Added Freescale Kinetis K20 support

@farcaller farcaller merged commit e876bf1 into hackndev:master Jul 7, 2014

1 of 2 checks passed

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

@bgamari bgamari deleted the bgamari:k20-simple branch Aug 28, 2014

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