Skip to content

Add a new target DELTA_DFCM_NNN40 #866

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

Merged
merged 14 commits into from
Feb 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* mbed Microcontroller Library

* Copyright (c) 2013 Nordic Semiconductor.
* Copyright (c) 2015 Nordic Semiconductor.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,8 +21,12 @@
#include "nrf51822.h"
#include "system_nrf51822.h"

#ifdef TARGET_DELTA_DFCM_NNN40

#define __SYSTEM_CLOCK (16000000UL) /*!< nRF51 devices use a fixed System Clock Frequency of 16MHz */
#define __SYSTEM_CLOCK (32000000UL) /*!< nRF51 devices use a fixed System Clock Frequency of 32MHz */
#else
#define __SYSTEM_CLOCK (16000000UL) /*!< nRF51 devices use a fixed System Clock Frequency of 16MHz */
#endif
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use 32MHz x'tal as SYSTEM CLOCK.


static bool is_manual_peripheral_setup_needed(void);
static bool is_disabled_in_debug_needed(void);
Expand Down Expand Up @@ -67,7 +71,7 @@ void SystemInit(void)

// Start the external 32khz crystal oscillator.

#ifdef TARGET_HRM1017
#ifdef TARGET_DELTA_DFCM_NNN40 || TARGET_HRM1017
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be

#if defined(TARGET_DELTA_DFCM_NNN40) || defined(TARGET_HRM1017)

NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_RC << CLOCK_LFCLKSRC_SRC_Pos);
#else
NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting LFCLKSRC to 32KHz internal crystal oscillator.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/* mbed Microcontroller Library
* Copyright (c) 2015 Nordic Semiconductor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_PINNAMES_H
#define MBED_PINNAMES_H

#include "cmsis.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
PIN_INPUT,
PIN_OUTPUT
} PinDirection;

#define PORT_SHIFT 3

typedef enum {
NC = (int)0xFFFFFFFF,
p0 = 0,
p1 = 1,
p2 = 2,
p3 = 3,
p4 = 4,
p5 = 5,
p6 = 6,
p7 = 7,
p8 = NC,
p9 = NC,
p10 = NC,
p11 = NC,
p12 = NC,
p13 = 13,
p14 = NC,
p15 = NC,
p16 = 16,
p17 = 17,
p18 = NC,
p19 = 19,
p20 = 20,
p21 = 21,
p22 = 22,
p23 = 23,
p24 = 24,
p25 = 25,
p26 = 26,
p27 = 27,
p28 = NC,
p29 = 29,
p30 = 30,
p31 = 31,

LED1 = p7,
LED2 = p13,

BUTTON0 = p16,
BUTTON1 = p17,

RX_PIN_NUMBER = p23,
TX_PIN_NUMBER = p25,

// mBed interface Pins
USBTX = TX_PIN_NUMBER,
USBRX = RX_PIN_NUMBER,

SPI_PSELMOSI0 = p24,
SPI_PSELMISO0 = p29,
SPI_PSELSS0 = p6,
SPI_PSELSCK0 = p21,

SPIS_PSELMOSI = p24,
SPIS_PSELMISO = p29,
SPIS_PSELSS = p6,
SPIS_PSELSCK = p21,

I2C_SDA0 = p22,
I2C_SCL0 = p20,

A0 = p0,
A1 = p1,
A2 = p2,
A3 = p3,
A4 = p4,
A5 = p5,

SWIO = p19,
VERF0 = p0,
// Not connected

CTS_PIN_NUMBER = NC,
RTS_PIN_NUMBER = NC,
SPI_PSELMOSI1 = NC,
SPI_PSELMISO1 = NC,
SPI_PSELSS1 = NC,
SPI_PSELSCK1 = NC,
LED3 = NC,
LED4 = NC
} PinName;

typedef enum {
PullNone = 0,
PullDown = 1,
PullUp = 3,
PullDefault = PullUp
} PinMode;

#ifdef __cplusplus
}
#endif

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2015 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_DEVICE_H
#define MBED_DEVICE_H

#define DEVICE_PORTIN 1
#define DEVICE_PORTOUT 1
#define DEVICE_PORTINOUT 1

#define DEVICE_INTERRUPTIN 1

#define DEVICE_ANALOGIN 1
#define DEVICE_ANALOGOUT 0

#define DEVICE_SERIAL 1

#define DEVICE_I2C 1
#define DEVICE_I2CSLAVE 0

#define DEVICE_SPI 1
#define DEVICE_SPISLAVE 1

#define DEVICE_CAN 0

#define DEVICE_RTC 0

#define DEVICE_ETHERNET 0

#define DEVICE_PWMOUT 1

#define DEVICE_SEMIHOST 0
#define DEVICE_LOCALFILESYSTEM 0

#define DEVICE_SLEEP 1

#define DEVICE_DEBUG_AWARENESS 1

#define DEVICE_STDIO_MESSAGES 0

#define DEVICE_ERROR_PATTERN 1

#include "objects.h"

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* mbed Microcontroller Library
* Copyright (c) 2015, Cyntec
*/
#include "cmsis.h"

// This function is called after RAM initialization and before main.
void mbed_sdk_init()
{
// Default SWIO setting, pull SWIO(p19) to low for turning antenna switch to BLE radiated path.
#ifdef TARGET_DELTA_DFCM_NNN40
NRF_GPIO->PIN_CNF[19] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos)
| (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos)
| (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos)
| (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos)
| (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);

NRF_GPIO->OUTCLR = (GPIO_OUTCLR_PIN19_Clear << GPIO_OUTCLR_PIN19_Pos);

#endif
}
Empty file.
2 changes: 1 addition & 1 deletion libraries/tests/mbed/analog/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ int main() {
}

notify_completion(check);
}
}
3 changes: 3 additions & 0 deletions libraries/tests/mbed/i2c_eeprom/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ I2C i2c(P0_23, P0_22);
#elif defined(TARGET_LPC11U68)
I2C i2c(SDA, SCL);

#elif defined(TARGET_DELTA_DFCM_NNN40)
I2C i2c(I2C_SDA0, I2C_SCL0);

#elif defined(TARGET_NUCLEO_F030R8) || \
defined(TARGET_NUCLEO_F070RB) || \
defined(TARGET_NUCLEO_F072RB) || \
Expand Down
3 changes: 3 additions & 0 deletions libraries/tests/mbed/i2c_eeprom_line/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ I2C i2c(P0_23, P0_22);
#elif defined(TARGET_LPC11U68)
I2C i2c(SDA, SCL);

#elif defined(TARGET_DELTA_DFCM_NNN40)
I2C i2c(I2C_SDA0, I2C_SCL0);

#elif defined(TARGET_NUCLEO_F030R8) || \
defined(TARGET_NUCLEO_F070RB) || \
defined(TARGET_NUCLEO_F072RB) || \
Expand Down
76 changes: 76 additions & 0 deletions workspace_tools/export/gcc_arm_delta_dfcm_nnn40.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# This file was automagically generated by mbed.org. For more information,
# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded

GCC_BIN =
PROJECT = {{name}}
OBJECTS = {% for f in to_be_compiled %}{{f}} {% endfor %}
SYS_OBJECTS = {% for f in object_files %}{{f}} {% endfor %}
INCLUDE_PATHS = {% for p in include_paths %}-I{{p}} {% endfor %}
LIBRARY_PATHS = {% for p in library_paths %}-L{{p}} {% endfor %}
LIBRARIES = {% for lib in libraries %}-l{{lib}} {% endfor %}
LINKER_SCRIPT = {{linker_script}}
SOFTDEVICE = mbed/TARGET_NRF51822/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/s110_nrf51822_7_0_0/s110_nrf51822_7.0.0_softdevice.hex

###############################################################################
AS = $(GCC_BIN)arm-none-eabi-as
CC = $(GCC_BIN)arm-none-eabi-gcc
CPP = $(GCC_BIN)arm-none-eabi-g++
LD = $(GCC_BIN)arm-none-eabi-gcc
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
SIZE = $(GCC_BIN)arm-none-eabi-size
SREC_CAT = srec_cat

CPU = -mcpu=cortex-m0 -mthumb
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer
CC_FLAGS += -MMD -MP
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}

LD_FLAGS = $(CPU) -Wl,--gc-sections -Wl,--wrap=main --specs=nano.specs -u _printf_float -u _scanf_float
LD_FLAGS += -Wl,-Map=$(PROJECT).map,--cref
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys

ifeq ($(DEBUG), 1)
CC_FLAGS += -DDEBUG -O0
else
CC_FLAGS += -DNDEBUG -Os
endif

all: $(PROJECT).bin $(PROJECT).hex

clean:
rm -f $(PROJECT).bin $(PROJECT).elf $(PROJECT).hex $(PROJECT).map $(PROJECT).lst $(OBJECTS) $(DEPS)

.s.o:
$(AS) $(CPU) -o $@ $<

.c.o:
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $<

.cpp.o:
$(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $<


$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)
$(SIZE) $@

$(PROJECT).bin: $(PROJECT).elf
@$(OBJCOPY) -O binary $< $@

$(PROJECT).hex: $(PROJECT).elf
@$(OBJCOPY) -O ihex $< $@

$(PROJECT).lst: $(PROJECT).elf
@$(OBJDUMP) -Sdh $< > $@

lst: $(PROJECT).lst

size:
$(SIZE) $(PROJECT).elf

DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d)
-include $(DEPS)

merge:
$(SREC_CAT) $(SOFTDEVICE) -intel $(PROJECT).hex -intel -o combined.hex -intel --line-length=44
1 change: 1 addition & 0 deletions workspace_tools/export/gccarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class GccArm(Exporter):
'NRF51_DONGLE',
'BLE_SMURFS',
'DISCO_F401VC',
'DELTA_DFCM_NNN40',
]

DOT_IN_RELATIVE_PATH = True
Expand Down
1 change: 1 addition & 0 deletions workspace_tools/export/uvision4.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class Uvision4(Exporter):
'NRF51_DONGLE',
'BLE_SMURFS',
'LPC11U37H_401',
'DELTA_DFCM_NNN40',
]

USING_MICROLIB = [
Expand Down
Loading