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,7 +52,10 @@ 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",
'-I%s' % ARM_INC
@ -64,7 +67,7 @@ class ARM(mbedToolchain):
self.cppc = [main_cc] + common + common_c + ["--cpp", "--no_rtti"]
else:
self.cc = [join(GOANNA_PATH, "goannacc"), "--with-cc=" + main_cc.replace('\\', '/'), "--dialect=armcc", '--output-format="%s"' % self.GOANNA_FORMAT] + common + common_c + ["--c99"]
self.cppc= [join(GOANNA_PATH, "goannac++"), "--with-cxx=" + main_cc.replace('\\', '/'), "--dialect=armcc", '--output-format="%s"' % self.GOANNA_FORMAT] + common + common_c + ["--cpp", "--no_rtti"]
self.cppc= [join(GOANNA_PATH, "goannac++"), "--with-cxx=" + main_cc.replace('\\', '/'), "--dialect=armcc", '--output-format="%s"' % self.GOANNA_FORMAT] + common + common_c + ["--cpp", "--no_rtti"]
self.ld = [join(ARM_BIN, "armlink")]
self.sys_libs = []

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++")
@ -151,7 +154,7 @@ class GCC(mbedToolchain):
# NOTE: There is a circular dependency between the mbed library and the clib
# We could define a set of week symbols to satisfy the clib dependencies in "sys.o",
# but if an application uses only clib symbols and not mbed symbols, then the final
# image is not correctly retargeted
# image is not correctly retargeted
if self.CIRCULAR_DEPENDENCIES:
libs.extend(libs)

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")