mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
0cd322f5c3
commit
cbe3a40986
|
@ -20,6 +20,8 @@
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "fsl_clock_manager.h"
|
#include "fsl_clock_manager.h"
|
||||||
#include "fsl_i2c_hal.h"
|
#include "fsl_i2c_hal.h"
|
||||||
|
#include "fsl_port_hal.h"
|
||||||
|
#include "fsl_sim_hal.h"
|
||||||
|
|
||||||
static const PinMap PinMap_I2C_SDA[] = {
|
static const PinMap PinMap_I2C_SDA[] = {
|
||||||
{PTE25, I2C_0, 5},
|
{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(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_hal_enable(obj->instance);
|
||||||
i2c_frequency(obj, 100000);
|
i2c_frequency(obj, 100000);
|
||||||
|
|
||||||
pinmap_pinout(sda, PinMap_I2C_SDA);
|
pinmap_pinout(sda, PinMap_I2C_SDA);
|
||||||
pinmap_pinout(scl, PinMap_I2C_SCL);
|
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) {
|
int i2c_start(i2c_t *obj) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ARM(mbedToolchain):
|
||||||
main_cc = join(ARM_BIN, "armcc")
|
main_cc = join(ARM_BIN, "armcc")
|
||||||
common = ["-c",
|
common = ["-c",
|
||||||
"--cpu=%s" % cpu, "--gnu",
|
"--cpu=%s" % cpu, "--gnu",
|
||||||
"-O3", "-Otime", "--split_sections", "--apcs=interwork",
|
"-Otime", "--split_sections", "--apcs=interwork",
|
||||||
"--brief_diagnostics", "--restrict"
|
"--brief_diagnostics", "--restrict"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -52,7 +52,10 @@ class ARM(mbedToolchain):
|
||||||
|
|
||||||
if "debug-info" in self.options:
|
if "debug-info" in self.options:
|
||||||
common.append("-g")
|
common.append("-g")
|
||||||
|
common.append("-O0")
|
||||||
|
else:
|
||||||
|
common.append("-O3")
|
||||||
|
|
||||||
common_c = [
|
common_c = [
|
||||||
"--md", "--no_depend_system_headers",
|
"--md", "--no_depend_system_headers",
|
||||||
'-I%s' % ARM_INC
|
'-I%s' % ARM_INC
|
||||||
|
@ -64,7 +67,7 @@ class ARM(mbedToolchain):
|
||||||
self.cppc = [main_cc] + common + common_c + ["--cpp", "--no_rtti"]
|
self.cppc = [main_cc] + common + common_c + ["--cpp", "--no_rtti"]
|
||||||
else:
|
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.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.ld = [join(ARM_BIN, "armlink")]
|
||||||
self.sys_libs = []
|
self.sys_libs = []
|
||||||
|
|
|
@ -49,7 +49,7 @@ class GCC(mbedToolchain):
|
||||||
|
|
||||||
# Note: We are using "-O2" instead of "-Os" to avoid this known GCC bug:
|
# Note: We are using "-O2" instead of "-Os" to avoid this known GCC bug:
|
||||||
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46762
|
# 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",
|
"-Wno-unused-parameter", "-Wno-missing-field-initializers",
|
||||||
"-fmessage-length=0", "-fno-exceptions", "-fno-builtin",
|
"-fmessage-length=0", "-fno-exceptions", "-fno-builtin",
|
||||||
"-ffunction-sections", "-fdata-sections",
|
"-ffunction-sections", "-fdata-sections",
|
||||||
|
@ -61,6 +61,9 @@ class GCC(mbedToolchain):
|
||||||
|
|
||||||
if "debug-info" in self.options:
|
if "debug-info" in self.options:
|
||||||
common_flags.append("-g")
|
common_flags.append("-g")
|
||||||
|
common_flags.append("-O0")
|
||||||
|
else:
|
||||||
|
common_flags.append("-O2")
|
||||||
|
|
||||||
main_cc = join(tool_path, "arm-none-eabi-gcc")
|
main_cc = join(tool_path, "arm-none-eabi-gcc")
|
||||||
main_cppc = join(tool_path, "arm-none-eabi-g++")
|
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
|
# 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",
|
# 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
|
# 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:
|
if self.CIRCULAR_DEPENDENCIES:
|
||||||
libs.extend(libs)
|
libs.extend(libs)
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ class IAR(mbedToolchain):
|
||||||
mbedToolchain.__init__(self, target, options, notify, macros)
|
mbedToolchain.__init__(self, target, options, notify, macros)
|
||||||
|
|
||||||
c_flags = [
|
c_flags = [
|
||||||
"-Oh",
|
|
||||||
"--cpu=%s" % target.core, "--thumb",
|
"--cpu=%s" % target.core, "--thumb",
|
||||||
"--dlib_config", join(IAR_PATH, "inc", "c", "DLib_Config_Full.h"),
|
"--dlib_config", join(IAR_PATH, "inc", "c", "DLib_Config_Full.h"),
|
||||||
"-e", # Enable IAR language extension
|
"-e", # Enable IAR language extension
|
||||||
|
@ -47,6 +46,9 @@ class IAR(mbedToolchain):
|
||||||
|
|
||||||
if "debug-info" in self.options:
|
if "debug-info" in self.options:
|
||||||
c_flags.append("-r")
|
c_flags.append("-r")
|
||||||
|
c_flags.append("-On")
|
||||||
|
else:
|
||||||
|
c_flags.append("-Oh")
|
||||||
|
|
||||||
IAR_BIN = join(IAR_PATH, "bin")
|
IAR_BIN = join(IAR_PATH, "bin")
|
||||||
main_cc = join(IAR_BIN, "iccarm")
|
main_cc = join(IAR_BIN, "iccarm")
|
||||||
|
|
Loading…
Reference in New Issue