Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Commit

Permalink
Store build artifacts in product dependent directory. E.g. when build…
Browse files Browse the repository at this point in the history
…ing for LPC1768, all build artifacts will show up in <repo>\Zelig\LLVM2IR_results\mbed\simple\LPC1768

Rename product types in board configration files types.
Cleanup for board configurations and sample application.
  • Loading branch information
lt72 committed Mar 7, 2016
1 parent 9371202 commit d2669ec
Show file tree
Hide file tree
Showing 58 changed files with 1,187 additions and 818 deletions.
69 changes: 50 additions & 19 deletions Zelig/BoardConfigurations/K64F/Board/HardwareModel/Board.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,41 @@ public sealed class Board : Chipset.Board

public static readonly ChipsetAbstration.Board.SerialPortInfo UART0 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.PTC14,
RxPin = (int)PinName.PTC15,
RtsPin = unchecked((int)PinName.NC),
CtsPin = unchecked((int)PinName.NC)
TxPin = (int)PinName.PTC14,
RxPin = (int)PinName.PTC15,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};

public static readonly ChipsetAbstration.Board.SerialPortInfo UART1 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.USBTX,
RxPin = (int)PinName.USBRX,
RtsPin = unchecked((int)PinName.NC),
CtsPin = unchecked((int)PinName.NC)
TxPin = (int)PinName.USBTX,
RxPin = (int)PinName.USBRX,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};

public static readonly ChipsetAbstration.Board.SerialPortInfo UART3 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.PTC17,
RxPin = (int)PinName.PTC16,
RtsPin = unchecked((int)PinName.NC),
CtsPin = unchecked((int)PinName.NC)
TxPin = (int)PinName.PTC17,
RxPin = (int)PinName.PTC16,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};

//--//

private static readonly int[] s_ledPins = new int[]
{
(int)K64F.PinName.LED1,
(int)K64F.PinName.LED2,
(int)K64F.PinName.LED3,
(int)K64F.PinName.LED4,
};

private static readonly int[] s_pwmPins = new int[]
{
(int)K64F.PinName.D3,
};

//
Expand All @@ -54,6 +69,14 @@ public override int PinCount
return 160;
}
}

public override int PinToIndex( int pin )
{
int port = pin >> Board.GPIO_PORT_SHIFT;
int portIndex = pin & 0x000000FF;

return ( port * 32 ) + portIndex;
}

public override int NCPin
{
Expand All @@ -62,13 +85,21 @@ public override int NCPin
return -1;
}
}
public override int PinToIndex( int pin )

public override int[] LedPins
{
int port = pin >> Board.GPIO_PORT_SHIFT;
int portIndex = pin & 0x000000FF;
get
{
return s_ledPins;
}
}

return ( port * 32 ) + portIndex;
public override int[] PwmPins
{
get
{
return s_pwmPins;
}
}

//
Expand Down Expand Up @@ -97,12 +128,12 @@ public override ChipsetAbstration.Board.SerialPortInfo GetSerialPortInfo(string
//
// System timer
//
public override int GetSystemTimerIRQNumber( )
public override int GetSystemTimerIRQ( )
{
return (int)IRQn.PIT3_IRQn;
}

public override int GetSerialPortIRQNumber(string portName)
public override int GetSerialPortIRQ(string portName)
{
switch (portName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.Llilum.K64F
using ChipsetModel = Microsoft.CortexM4OnMBED;


[RT.ProductFilter("Microsoft.Llilum.BoardConfigurations.K64FMBEDHosted")]
[RT.ProductFilter("Microsoft.Llilum.BoardConfigurations.K64FMBED")]
public sealed class Processor : Microsoft.CortexM4OnMBED.Processor
{
public new class Context : ChipsetModel.Processor.Context
Expand Down
28 changes: 14 additions & 14 deletions Zelig/BoardConfigurations/K64F/Configuration/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ namespace Microsoft.Llilum.BoardConfigurations
using Microsoft.Zelig.Configuration.Environment;

[DisplayName("K64F")]
public sealed class K64F : ProcessorCategory
public sealed class K64FSoC : ProcessorCategory
{
[DependsOn(typeof(K64F))]
[DependsOn(typeof(K64FSoC))]
[DisplayName("Internal 256KB Static RAM")]
[Defaults ( "BaseAddress" , 0x1FFF0000U )]
[Defaults ( "SizeInBytes" , 256 * 1024 )]
Expand All @@ -25,7 +25,7 @@ public sealed class InternalRAM256KB : RamMemoryCategory
}


[DependsOn( typeof( K64F ) )]
[DependsOn( typeof( K64FSoC ) )]
[DisplayName( "Internal 512KB FLASH" )]
[Defaults( "BaseAddress", 0x00000000 )]
[Defaults( "SizeInBytes", 1024 * 1024 )]
Expand Down Expand Up @@ -55,7 +55,7 @@ public sealed class K64FMemoryMap : MemoryMapCategory
MemoryUsage.Heap |
MemoryUsage.DataRW |
MemoryUsage.Code )]
[AllowedOptions( typeof( K64F.InternalRAM256KB ) )]
[AllowedOptions( typeof( K64FSoC.InternalRAM256KB ) )]
[Defaults( "BaseAddress", 0x1FFF0000U )]
public RamMemoryCategory InternalRamChip;

Expand All @@ -68,7 +68,7 @@ public sealed class K64FMemoryMap : MemoryMapCategory
MemoryUsage.DataRO |
MemoryUsage.VectorsTable |
MemoryUsage.Relocation )]
[AllowedOptions( typeof( K64F.InternalFlash1024KB ) )]
[AllowedOptions( typeof( K64FSoC.InternalFlash1024KB ) )]
[Defaults( "BaseAddress", 0x00000000U )]
public FlashMemoryCategory InternalFlashChip;
}
Expand All @@ -77,23 +77,23 @@ public sealed class K64FMemoryMap : MemoryMapCategory
//--//
//--//

[DisplayName("K64F MBED Hosted")]
public sealed class K64FMBEDHosted : ProductCategory
[DisplayName("K64F MBED")]
public sealed class K64F : ProductCategory
{
[AllowedOptions(typeof(K64F))]
[AllowedOptions(typeof(K64FSoC))]
[Defaults("CoreClockFrequency" , 120000000UL)]
[Defaults("RealTimeClockFrequency", 1000000UL )]
[Defaults("DefaultThreadPoolThreads", 3)]
[Defaults("DefaultTimerPoolThreads" , 2)]
public K64F Processor;
public K64FSoC Processor;

//--//

[AllowedOptions( typeof( K64F.InternalRAM256KB ) )]
[AllowedOptions( typeof( K64FSoC.InternalRAM256KB ) )]
[Defaults( "BaseAddress", 0x1FFF0000U )]
public RamMemoryCategory InternalRam;

[AllowedOptions( typeof( K64F.InternalFlash1024KB ) )]
[AllowedOptions( typeof( K64FSoC.InternalFlash1024KB ) )]
[Defaults( "BaseAddress", 0x00000000U )]
public FlashMemoryCategory InternalFlashChip;
}
Expand All @@ -102,12 +102,12 @@ public sealed class K64FMBEDHosted : ProductCategory
//--//
//--//

[DisplayName("LLVM Hosted Compilation for K64F")]
[DisplayName("LLVM Compilation for K64F")]
[Defaults("Platform", typeof(Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.ArmV7M_VFP))]
[Defaults("CallingConvention", typeof(Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.ArmV7MCallingConvention))]
[Defaults("Product", typeof(K64FMBEDHosted))]
[Defaults("Product", typeof(K64F))]
[Defaults("MemoryMap", typeof(K64FMemoryMap))]
public sealed class K64FMBEDHostedCompilationSetup : CompilationSetupCategory
public sealed class K64FMBEDCompilationSetup : CompilationSetupCategory
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
-Architecture cortex-m4

#~#-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.K64F.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.K64FMBEDHostedCompilationSetup
-CompilationSetup Microsoft.Llilum.BoardConfigurations.K64FMBEDCompilationSetup


###
Expand Down
59 changes: 46 additions & 13 deletions Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/Board.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,37 @@ public sealed class Board : Chipset.Board

public static readonly ChipsetAbstration.Board.SerialPortInfo UART0 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.USBTX,
RxPin = (int)PinName.USBRX,
RtsPin = unchecked((int)PinName.NC),
CtsPin = unchecked((int)PinName.NC)
TxPin = (int)PinName.USBTX,
RxPin = (int)PinName.USBRX,
RtsPin = unchecked( (int)PinName.NC ) ,
CtsPin = unchecked( (int)PinName.NC ) ,
};

public static readonly ChipsetAbstration.Board.SerialPortInfo UART1 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.p13,
RxPin = (int)PinName.p14,
RtsPin = unchecked((int)PinName.NC),
CtsPin = unchecked ((int)PinName.NC)
TxPin = (int)PinName.p13 ,
RxPin = (int)PinName.p14 ,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};

//--//

private static readonly int[] s_ledPins = new int[]
{
(int)LPC1768.PinName.LED1,
(int)LPC1768.PinName.LED2,
(int)LPC1768.PinName.LED3,
(int)LPC1768.PinName.LED4,
};

private static readonly int[] s_pwmPins = new int[]
{
(int)LPC1768.PinName.p21,
};

//--//

//
// Gpio discovery
//
Expand All @@ -43,6 +60,11 @@ public override int PinCount
return 40;
}
}

public override int PinToIndex( int pin )
{
return pin - (int)PinName.P0_0;
}

public override int NCPin
{
Expand All @@ -51,10 +73,21 @@ public override int NCPin
return -1;
}
}
public override int PinToIndex( int pin )

public override int[] LedPins
{
return pin - (int)PinName.P0_0;
get
{
return s_ledPins;
}
}

public override int[] PwmPins
{
get
{
return s_pwmPins;
}
}

//
Expand All @@ -79,7 +112,7 @@ public override ChipsetAbstration.Board.SerialPortInfo GetSerialPortInfo(string
}
}

public override int GetSerialPortIRQNumber(string portName)
public override int GetSerialPortIRQ(string portName)
{
switch (portName)
{
Expand All @@ -95,7 +128,7 @@ public override int GetSerialPortIRQNumber(string portName)
//
// System timer
//
public override int GetSystemTimerIRQNumber( )
public override int GetSystemTimerIRQ( )
{
return (int)IRQn.TIMER3_IRQn;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ public sealed class SpiProvider : Chipset.HardwareModel.SpiProvider
{
public static readonly SpiChannelInfo SPI0 = new SpiChannelInfo()
{
Mosi = (int)PinName.p5,
Miso = (int)PinName.p6,
Sclk = (int)PinName.p7,
DefaultChipSelect = (int)PinName.p8,
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
Mosi = (int)PinName.p5,
Miso = (int)PinName.p6,
Sclk = (int)PinName.p7,
DefaultChipSelect = (int)PinName.p8,
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};

public static readonly SpiChannelInfo SPI1 = new SpiChannelInfo()
{
Mosi = (int)PinName.p11,
Miso = (int)PinName.p12,
Sclk = (int)PinName.p13,
DefaultChipSelect = (int)PinName.p14,
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
Mosi = (int)PinName.p11,
Miso = (int)PinName.p12,
Sclk = (int)PinName.p13,
DefaultChipSelect = (int)PinName.p14,
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};

public override bool SpiBusySupported
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.Llilum.LPC1768
using ChipsetModel = Microsoft.CortexM3OnMBED;


[RT.ProductFilter("Microsoft.Llilum.BoardConfigurations.LPC1768MBEDHosted")]
[RT.ProductFilter("Microsoft.Llilum.BoardConfigurations.LPC1768MBED")]
public sealed class Processor : Microsoft.CortexM3OnMBED.Processor
{
public new class Context : ChipsetModel.Processor.Context
Expand Down

0 comments on commit d2669ec

Please sign in to comment.