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

Commit a1d43d2

Browse files
committed
Merge branch 'Support-GCC' of https://github.com/NETMF/netmf-interpreter into Support-GCC
2 parents 69809ee + 4d0adb1 commit a1d43d2

32 files changed

+3863
-1
lines changed

DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_Bootstrap/GNU_S/DefaultHandlers.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2727
@ Dummy Exception Handlers (infinite loops which can be overloaded since they are exported with weak linkage )
2828

29-
.section SectionForBootsrtapOperations, "ax", %progbits
29+
.section SectionForBootstrapOperations, "ax", %progbits
3030

3131
.align 1
3232
.thumb_func
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Copyright (c) Microsoft Corporation. All rights reserved.
8+
// Implementation for the MCBSTM32F400 board (STM32F4): Copyright (c) Oberon microsystems, Inc.
9+
//
10+
// *** STM32F4DISCOVERY Block Storage Configuration ***
11+
//
12+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
13+
14+
#include <tinyhal.h>
15+
16+
#define FLASH_MANUFACTURER_CODE 0x0000 // not used
17+
#define FLASH_DEVICE_CODE 0x0000 // not used
18+
#define FLASH_BASE_ADDRESS1 0x08000000
19+
#define FLASH_BLOCK_COUNT1 4
20+
#define FLASH_BYTES_PER_BLOCK1 0x04000
21+
#define FLASH_BASE_ADDRESS2 0x08010000
22+
#define FLASH_BLOCK_COUNT2 1
23+
#define FLASH_BYTES_PER_BLOCK2 0x10000
24+
#define FLASH_BASE_ADDRESS3 0x08020000
25+
#define FLASH_BLOCK_COUNT3 7
26+
#define FLASH_BYTES_PER_BLOCK3 0x20000
27+
#define FLASH_BYTES_PER_SECTOR 2
28+
#define FLASH_BLOCK_ERASE_TYPICAL_TIME_USEC 1000000 // not used
29+
#define FLASH_SECTOR_WRITE_TYPICAL_TIME_USEC 10 // not used
30+
#define FLASH_BLOCK_ERASE_MAX_TIME_USEC 4000000 // not used
31+
#define FLASH_SECTOR_WRITE_MAX_TIME_USEC 100 // not used
32+
#define FLASH_BLOCK_ERASE_ACTUAL_TIME_USEC 10000 // not used
33+
34+
// EBIU Information
35+
36+
#define STM32F4__CHIP_SELECT 0
37+
#define STM32F4__WAIT_STATES 5 // not used
38+
#define STM32F4__RELEASE_COUNTS 0
39+
#define STM32F4__BIT_WIDTH 16
40+
#define STM32F4__BASE_ADDRESS 0x08000000
41+
#define STM32F4__SIZE_IN_BYTES 0x00100000
42+
#define STM32F4__WP_GPIO_PIN GPIO_PIN_NONE
43+
#define STM32F4__WP_ACTIVE FALSE
44+
45+
// BlockDeviceInformation
46+
47+
#define STM32F4__IS_REMOVABLE FALSE
48+
#define STM32F4__SUPPORTS_XIP TRUE
49+
#define STM32F4__WRITE_PROTECTED FALSE
50+
#define STM32F4__SUPP_COPY_BACK FALSE
51+
#define STM32F4__NUM_REGIONS 3
52+
53+
const BlockRange g_STM32F4_BlockRange1[] =
54+
{
55+
{ BlockRange::BLOCKTYPE_BOOTSTRAP , 0, 2 }, // 08000000 bootloader 48k
56+
{ BlockRange::BLOCKTYPE_CONFIG , 3, 3 }, // 0800C000 config 16k
57+
};
58+
59+
const BlockRange g_STM32F4_BlockRange2[] =
60+
{
61+
{ BlockRange::BLOCKTYPE_CODE , 0, 0 }, // 08010000 CLR 64k
62+
};
63+
64+
const BlockRange g_STM32F4_BlockRange3[] =
65+
{
66+
{ BlockRange::BLOCKTYPE_CODE , 0, 3 }, // 08020000 CLR 512k
67+
{ BlockRange::BLOCKTYPE_DEPLOYMENT, 4, 6 }, // 08080000 deployment 384k
68+
};
69+
70+
const BlockRegionInfo g_STM32F4_BlkRegion[STM32F4__NUM_REGIONS] =
71+
{
72+
{
73+
FLASH_BASE_ADDRESS1, // ByteAddress Start; // Starting Sector address
74+
FLASH_BLOCK_COUNT1, // UINT32 NumBlocks; // total number of blocks in this region
75+
FLASH_BYTES_PER_BLOCK1, // UINT32 BytesPerBlock; // Total number of bytes per block
76+
ARRAYSIZE_CONST_EXPR(g_STM32F4_BlockRange1),
77+
g_STM32F4_BlockRange1,
78+
},
79+
80+
{
81+
FLASH_BASE_ADDRESS2, // ByteAddress Start; // Starting Sector address
82+
FLASH_BLOCK_COUNT2, // UINT32 NumBlocks; // total number of blocks in this region
83+
FLASH_BYTES_PER_BLOCK2, // UINT32 BytesPerBlock; // Total number of bytes per block
84+
ARRAYSIZE_CONST_EXPR(g_STM32F4_BlockRange2),
85+
g_STM32F4_BlockRange2,
86+
},
87+
88+
{
89+
FLASH_BASE_ADDRESS3, // ByteAddress Start; // Starting Sector address
90+
FLASH_BLOCK_COUNT3, // UINT32 NumBlocks; // total number of blocks in this region
91+
FLASH_BYTES_PER_BLOCK3, // UINT32 BytesPerBlock; // Total number of bytes per block
92+
ARRAYSIZE_CONST_EXPR(g_STM32F4_BlockRange3),
93+
g_STM32F4_BlockRange3,
94+
}
95+
};
96+
97+
const BlockDeviceInfo g_STM32F4_DeviceInfo=
98+
{
99+
{
100+
STM32F4__IS_REMOVABLE, // BOOL Removable;
101+
STM32F4__SUPPORTS_XIP, // BOOL SupportsXIP;
102+
STM32F4__WRITE_PROTECTED, // BOOL WriteProtected;
103+
STM32F4__SUPP_COPY_BACK // BOOL SupportsCopyBack
104+
},
105+
FLASH_SECTOR_WRITE_TYPICAL_TIME_USEC, // UINT32 MaxSectorWrite_uSec;
106+
FLASH_BLOCK_ERASE_ACTUAL_TIME_USEC, // UINT32 MaxBlockErase_uSec;
107+
FLASH_BYTES_PER_SECTOR, // UINT32 BytesPerSector;
108+
109+
FLASH_MEMORY_Size, // UINT32 Size;
110+
111+
STM32F4__NUM_REGIONS, // UINT32 NumRegions;
112+
g_STM32F4_BlkRegion, // const BlockRegionInfo* pRegions;
113+
};
114+
115+
struct MEMORY_MAPPED_NOR_BLOCK_CONFIG g_STM32F4_BS_Config =
116+
{
117+
{ // BLOCK_CONFIG
118+
{
119+
STM32F4__WP_GPIO_PIN, // GPIO_PIN Pin;
120+
STM32F4__WP_ACTIVE, // BOOL ActiveState;
121+
},
122+
123+
&g_STM32F4_DeviceInfo, // BlockDeviceinfo
124+
},
125+
126+
{ // CPU_MEMORY_CONFIG
127+
STM32F4__CHIP_SELECT, // UINT8 CPU_MEMORY_CONFIG::ChipSelect;
128+
TRUE, // UINT8 CPU_MEMORY_CONFIG::ReadOnly;
129+
STM32F4__WAIT_STATES, // UINT32 CPU_MEMORY_CONFIG::WaitStates;
130+
STM32F4__RELEASE_COUNTS, // UINT32 CPU_MEMORY_CONFIG::ReleaseCounts;
131+
STM32F4__BIT_WIDTH, // UINT32 CPU_MEMORY_CONFIG::BitWidth;
132+
STM32F4__BASE_ADDRESS, // UINT32 CPU_MEMORY_CONFIG::BaseAddress;
133+
STM32F4__SIZE_IN_BYTES, // UINT32 CPU_MEMORY_CONFIG::SizeInBytes;
134+
0, // UINT8 CPU_MEMORY_CONFIG::XREADYEnable
135+
0, // UINT8 CPU_MEMORY_CONFIG::ByteSignalsForRead
136+
0, // UINT8 CPU_MEMORY_CONFIG::ExternalBufferEnable
137+
},
138+
139+
0, // UINT32 ChipProtection;
140+
FLASH_MANUFACTURER_CODE, // UINT32 ManufacturerCode;
141+
FLASH_DEVICE_CODE, // UINT32 DeviceCode;
142+
};
143+
144+
struct BlockStorageDevice g_STM32F4_BS;
145+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<PropertyGroup>
3+
<AssemblyName>STM32F4_blconfig_STM32F4DISCOVERY</AssemblyName>
4+
<Size>
5+
</Size>
6+
<ProjectGuid>{92AED3B3-6E69-445B-B9AE-1AFBD162DBED}</ProjectGuid>
7+
<Description>Block storage configuration for STM32F4DISCOVERY</Description>
8+
<Level>HAL</Level>
9+
<LibraryFile>STM32F4_blconfig_STM32F4DISCOVERY.$(LIB_EXT)</LibraryFile>
10+
<ProjectPath>$(SPOCLIENT)\Solutions\STM32F4DISCOVERY\DeviceCode\Blockstorage\STM32F4\dotNetMF.proj</ProjectPath>
11+
<ManifestFile>STM32F4_blconfig_STM32F4DISCOVERY.$(LIB_EXT).manifest</ManifestFile>
12+
<Groups>Solutions\STM32F4DISCOVERY</Groups>
13+
<LibraryCategory>
14+
<MFComponent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="BlockStorageConfig_HAL" Guid="{497F59BB-55D3-404e-B958-A6284806D184}" ProjectPath="" xmlns="">
15+
<VersionDependency xmlns="http://schemas.microsoft.com/netmf/InventoryFormat.xsd">
16+
<Major>4</Major>
17+
<Minor>0</Minor>
18+
<Revision>0</Revision>
19+
<Build>0</Build>
20+
<Extra />
21+
<Date>2009-08-12</Date>
22+
</VersionDependency>
23+
<ComponentType xmlns="http://schemas.microsoft.com/netmf/InventoryFormat.xsd">LibraryCategory</ComponentType>
24+
</MFComponent>
25+
</LibraryCategory>
26+
<Documentation>
27+
</Documentation>
28+
<PlatformIndependent>False</PlatformIndependent>
29+
<CustomSpecific>STM32F4DISCOVERY</CustomSpecific>
30+
<Required>False</Required>
31+
<IgnoreDefaultLibPath>False</IgnoreDefaultLibPath>
32+
<IsStub>False</IsStub>
33+
<Directory>Solutions\STM32F4DISCOVERY\DeviceCode\BlockStorage\STM32F4</Directory>
34+
<OutputType>Library</OutputType>
35+
<PlatformIndependentBuild>false</PlatformIndependentBuild>
36+
<Version>4.0.0.0</Version>
37+
</PropertyGroup>
38+
<Import Project="$(SPOCLIENT)\tools\targets\Microsoft.SPOT.System.Settings" />
39+
<PropertyGroup />
40+
<ItemGroup>
41+
<Compile Include="STM32F4_blconfig.cpp" />
42+
</ItemGroup>
43+
<ItemGroup />
44+
<Import Project="$(SPOCLIENT)\tools\targets\Microsoft.SPOT.System.Targets" />
45+
</Project>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Copyright (c) Microsoft Corporation. All rights reserved.
8+
// Implementation for the MCBSTM32F400 board (STM32F4): Copyright (c) Oberon microsystems, Inc.
9+
//
10+
// *** STM32F4DISCOVERY Block Storage AddDevice Configuration ***
11+
//
12+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
13+
14+
#include <tinyhal.h>
15+
16+
17+
extern struct BlockStorageDevice g_STM32F4_BS;
18+
extern struct IBlockStorageDevice g_STM32F4_Flash_DeviceTable;
19+
extern struct BLOCK_CONFIG g_STM32F4_BS_Config;
20+
21+
22+
23+
void BlockStorage_AddDevices()
24+
{
25+
BlockStorageList::AddDevice( &g_STM32F4_BS, &g_STM32F4_Flash_DeviceTable, &g_STM32F4_BS_Config, FALSE );
26+
}
27+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<PropertyGroup>
3+
<AssemblyName>BlockStorage_AddDevices_STM32F4DISCOVERY</AssemblyName>
4+
<Size>
5+
</Size>
6+
<ProjectGuid>{7BFA14C9-D40B-4EE7-BFFD-B1F749B922C8}</ProjectGuid>
7+
<Description>Block storage add device driver for STM32F4DISCOVERY</Description>
8+
<Level>HAL</Level>
9+
<LibraryFile>BlockStorage_AddDevices_STM32F4DISCOVERY.$(LIB_EXT)</LibraryFile>
10+
<ProjectPath>$(SPOCLIENT)\Solutions\STM32F4DISCOVERY\DeviceCode\Blockstorage\addDevices\dotNetMF.proj</ProjectPath>
11+
<ManifestFile>BlockStorage_AddDevices_STM32F4DISCOVERY.$(LIB_EXT).manifest</ManifestFile>
12+
<Groups>Solutions\STM32F4DISCOVERY</Groups>
13+
<LibraryCategory>
14+
<MFComponent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="BlockStorageAddDevices_HAL" Guid="{D1C1D946-18A1-4f12-807A-A182C4059D86}" ProjectPath="" xmlns="">
15+
<VersionDependency xmlns="http://schemas.microsoft.com/netmf/InventoryFormat.xsd">
16+
<Major>4</Major>
17+
<Minor>0</Minor>
18+
<Revision>0</Revision>
19+
<Build>0</Build>
20+
<Extra />
21+
<Date>2009-08-12</Date>
22+
</VersionDependency>
23+
<ComponentType xmlns="http://schemas.microsoft.com/netmf/InventoryFormat.xsd">LibraryCategory</ComponentType>
24+
</MFComponent>
25+
</LibraryCategory>
26+
<Documentation>
27+
</Documentation>
28+
<PlatformIndependent>False</PlatformIndependent>
29+
<CustomSpecific>STM32F4DISCOVERY</CustomSpecific>
30+
<Required>False</Required>
31+
<IgnoreDefaultLibPath>False</IgnoreDefaultLibPath>
32+
<IsStub>False</IsStub>
33+
<Directory>Solutions\STM32F4DISCOVERY\DeviceCode\BlockStorage\AddDevices</Directory>
34+
<OutputType>Library</OutputType>
35+
<PlatformIndependentBuild>false</PlatformIndependentBuild>
36+
<Version>4.0.0.0</Version>
37+
</PropertyGroup>
38+
<Import Project="$(SPOCLIENT)\tools\targets\Microsoft.SPOT.System.Settings" />
39+
<PropertyGroup />
40+
<ItemGroup>
41+
<Compile Include="Bl_AddDevices.cpp" />
42+
</ItemGroup>
43+
<ItemGroup />
44+
<Import Project="$(SPOCLIENT)\tools\targets\Microsoft.SPOT.System.Targets" />
45+
</Project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
2+
3+
<PropertyGroup>
4+
<Directory>Solutions\STM32F4DISCOVERY\DeviceCode\BlockStorage</Directory>
5+
</PropertyGroup>
6+
7+
<Import Project="$(SPOCLIENT)\tools\targets\Microsoft.SPOT.System.Settings" />
8+
9+
<ItemGroup>
10+
<SubDirectories Include="AddDevices"/>
11+
<SubDirectories Include="STM32F4"/>
12+
</ItemGroup>
13+
14+
<Import Project="$(SPOCLIENT)\tools\targets\Microsoft.SPOT.System.Targets" />
15+
16+
</Project>
17+
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Copyright (c) Microsoft Corporation. All rights reserved.
8+
// Implementation for the MCBSTM32F400 board (STM32F4): Copyright (c) Oberon microsystems, Inc.
9+
//
10+
// *** STM32F4DISCOVERY Board specific IO Port Initialization ***
11+
//
12+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
13+
14+
#define ARRAY_LENGTH(x) (sizeof(x)/sizeof(0[x]))
15+
16+
#include <tinyhal.h>
17+
#include "..\..\..\..\DeviceCode\Targets\Native\STM32F4\DeviceCode\stm32f4xx.h"
18+
19+
extern void STM32F4_GPIO_Pin_Config( GPIO_PIN pin, UINT32 mode, GPIO_RESISTOR resistor, UINT32 alternate ); // Workaround, since CPU_GPIO_DisablePin() does not correctly initialize pin speeds
20+
21+
void __section("SectionForBootstrapOperations") BootstrapCode_GPIO()
22+
{
23+
//#ifdef DEBUG
24+
// // PE2,3,4,5 are used for TRACECLK and TRACEDATA0-3 so don't enable them as address pins in debug builds
25+
// // This limits external FLASH and SRAM to 1MB addressable space each.
26+
// const uint8_t PortE_PinList[] = {0, 1, /*2, 3, 4, 5,*/ 7, 8, 9, 10, 11, 12, 13, 14, 15};
27+
//#else
28+
// const uint8_t PortE_PinList[] = {0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15};
29+
//#endif
30+
// const uint8_t PortF_PinList[] = {0, 1, 2, 3, 4, 5, 12, 13, 14, 15};
31+
// const uint8_t PortG_PinList[] = {0, 1, 2, 3, 4, 5, 10};
32+
//
33+
// const uint32_t pinConfig = 0x3C2; // Speed 100Mhz, AF12 FSMC, Alternate Mode
34+
// const uint32_t pinMode = pinConfig & 0xF;
35+
// const GPIO_ALT_MODE alternateMode = (GPIO_ALT_MODE) pinConfig;
36+
// const GPIO_RESISTOR resistorConfig = RESISTOR_PULLUP;
37+
//
38+
// uint32_t i;
39+
40+
/* Enable GPIO clocks */
41+
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN | RCC_AHB1ENR_GPIOBEN | RCC_AHB1ENR_GPIOCEN
42+
| RCC_AHB1ENR_GPIODEN | RCC_AHB1ENR_GPIOEEN | RCC_AHB1ENR_GPIOFEN
43+
| RCC_AHB1ENR_GPIOGEN | RCC_AHB1ENR_GPIOHEN | RCC_AHB1ENR_GPIOIEN;
44+
45+
CPU_GPIO_EnableOutputPin(LED3, FALSE);
46+
CPU_GPIO_EnableOutputPin(LED4, FALSE);
47+
CPU_GPIO_EnableOutputPin(LED5, FALSE);
48+
CPU_GPIO_EnableOutputPin(LED6, FALSE);
49+
50+
/*Initialize SRAM and NOR GPIOs */
51+
52+
//for(i = 0; i < ARRAY_LENGTH(PortE_PinList); i++) /* Port E */
53+
//{
54+
// CPU_GPIO_ReservePin( PORT_PIN(GPIO_PORTE, PortE_PinList[i]), TRUE);
55+
// CPU_GPIO_DisablePin( PORT_PIN(GPIO_PORTE, PortE_PinList[i]), resistorConfig, 0, alternateMode);
56+
// STM32F4_GPIO_Pin_Config( PORT_PIN(GPIO_PORTE, PortE_PinList[i]), pinMode, resistorConfig, pinConfig ); // Workaround, since CPU_GPIO_DisablePin() does not correctly initialize pin speeds
57+
//}
58+
//
59+
//for(i = 0; i < ARRAY_LENGTH(PortF_PinList); i++) /* Port F */
60+
//{
61+
// CPU_GPIO_ReservePin( PORT_PIN(GPIO_PORTF, PortF_PinList[i]), TRUE);
62+
// CPU_GPIO_DisablePin( PORT_PIN(GPIO_PORTF, PortF_PinList[i]), resistorConfig, 0, alternateMode);
63+
// STM32F4_GPIO_Pin_Config( PORT_PIN(GPIO_PORTF, PortF_PinList[i]), pinMode, resistorConfig, pinConfig ); // Workaround, since CPU_GPIO_DisablePin() does not correctly initialize pin speeds
64+
//}
65+
//
66+
//for(i = 0; i < ARRAY_LENGTH(PortG_PinList); i++) /* Port G */
67+
//{
68+
// CPU_GPIO_ReservePin( PORT_PIN(GPIO_PORTG, PortG_PinList[i]), TRUE);
69+
// CPU_GPIO_DisablePin( PORT_PIN(GPIO_PORTG, PortG_PinList[i]), resistorConfig, 0, alternateMode);
70+
// STM32F4_GPIO_Pin_Config( PORT_PIN(GPIO_PORTG, PortG_PinList[i]), pinMode, resistorConfig, pinConfig ); // Workaround, since CPU_GPIO_DisablePin() does not correctly initialize pin speeds
71+
//}
72+
}

0 commit comments

Comments
 (0)