K64F - i2c fix, debug-info sets optimization to

- debug-info for all toolchains set optimization to 0
	- i2c - open drain and clock enabled for i2c pins [K64F]
pull/299/head
0xc0170 2014-05-03 16:08:45 +01:00
parent 0cd322f5c3
commit cbe3a40986
4 changed files with 20 additions and 6 deletions

View File

@ -20,6 +20,8 @@
#include "error.h"
#include "fsl_clock_manager.h"
#include "fsl_i2c_hal.h"
#include "fsl_port_hal.h"
#include "fsl_sim_hal.h"
static const PinMap PinMap_I2C_SDA[] = {
{PTE25, I2C_0, 5},
@ -53,11 +55,15 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
}
clock_manager_set_gate(kClockModuleI2C, obj->instance, true);
clock_manager_set_gate(kClockModulePORT, sda >> GPIO_PORT_SHIFT, true);
clock_manager_set_gate(kClockModulePORT, scl >> GPIO_PORT_SHIFT, true);
i2c_hal_enable(obj->instance);
i2c_frequency(obj, 100000);
pinmap_pinout(sda, PinMap_I2C_SDA);
pinmap_pinout(scl, PinMap_I2C_SCL);
port_hal_configure_open_drain(sda >> GPIO_PORT_SHIFT, sda & 0xFF, true);
port_hal_configure_open_drain(scl >> GPIO_PORT_SHIFT, scl & 0xFF, true);
}
int i2c_start(i2c_t *obj) {

View File

@ -43,7 +43,7 @@ class ARM(mbedToolchain):
main_cc = join(ARM_BIN, "armcc")
common = ["-c",
"--cpu=%s" % cpu, "--gnu",
"-O3", "-Otime", "--split_sections", "--apcs=interwork",
"-Otime", "--split_sections", "--apcs=interwork",
"--brief_diagnostics", "--restrict"
]
@ -52,6 +52,9 @@ class ARM(mbedToolchain):
if "debug-info" in self.options:
common.append("-g")
common.append("-O0")
else:
common.append("-O3")
common_c = [
"--md", "--no_depend_system_headers",

View File

@ -49,7 +49,7 @@ class GCC(mbedToolchain):
# Note: We are using "-O2" instead of "-Os" to avoid this known GCC bug:
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46762
common_flags = ["-c", "-O2", "-Wall", "-Wextra",
common_flags = ["-c", "-Wall", "-Wextra",
"-Wno-unused-parameter", "-Wno-missing-field-initializers",
"-fmessage-length=0", "-fno-exceptions", "-fno-builtin",
"-ffunction-sections", "-fdata-sections",
@ -61,6 +61,9 @@ class GCC(mbedToolchain):
if "debug-info" in self.options:
common_flags.append("-g")
common_flags.append("-O0")
else:
common_flags.append("-O2")
main_cc = join(tool_path, "arm-none-eabi-gcc")
main_cppc = join(tool_path, "arm-none-eabi-g++")

View File

@ -33,7 +33,6 @@ class IAR(mbedToolchain):
mbedToolchain.__init__(self, target, options, notify, macros)
c_flags = [
"-Oh",
"--cpu=%s" % target.core, "--thumb",
"--dlib_config", join(IAR_PATH, "inc", "c", "DLib_Config_Full.h"),
"-e", # Enable IAR language extension
@ -47,6 +46,9 @@ class IAR(mbedToolchain):
if "debug-info" in self.options:
c_flags.append("-r")
c_flags.append("-On")
else:
c_flags.append("-Oh")
IAR_BIN = join(IAR_PATH, "bin")
main_cc = join(IAR_BIN, "iccarm")