From 01f708a6e14bfd321790a410654783e25de51a19 Mon Sep 17 00:00:00 2001 From: tkl Date: Thu, 18 Aug 2016 22:08:06 +0200 Subject: [PATCH] os lib version 0.1.1 --- config/linker/libs.ld | 8 + config/linker/mem.ld | 32 ++ config/linker/sections.ld | 445 ++++++++++++++++++ config/linker/stm32_flash.ld | 170 ------- source/application/drive_ctrl.c | 48 +- source/os/debug/include/board_devices.h | 9 +- ...bkosmos-arm-stm32f4-discovery-0.1.1-dbg.a} | Bin 484130 -> 486606 bytes .../libkosmos-arm-stm32f4-discovery-dbg.a | 2 +- source/os/release/include/board_devices.h | 9 +- .../release/libkosmos-arm-stm32f4-discovery.a | 2 +- 10 files changed, 519 insertions(+), 206 deletions(-) create mode 100644 config/linker/libs.ld create mode 100644 config/linker/mem.ld create mode 100644 config/linker/sections.ld delete mode 100755 config/linker/stm32_flash.ld rename source/os/debug/{libkosmos-arm-stm32f4-discovery-0.1.0-dbg.a => libkosmos-arm-stm32f4-discovery-0.1.1-dbg.a} (90%) diff --git a/config/linker/libs.ld b/config/linker/libs.ld new file mode 100644 index 0000000..70fea89 --- /dev/null +++ b/config/linker/libs.ld @@ -0,0 +1,8 @@ + +/* + * Placeholder to list other libraries required by the application. + +GROUP( +) + + */ diff --git a/config/linker/mem.ld b/config/linker/mem.ld new file mode 100644 index 0000000..e80fd60 --- /dev/null +++ b/config/linker/mem.ld @@ -0,0 +1,32 @@ +/* + * Memory Spaces Definitions. + * + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + * + * The values below can be addressed in further linker scripts + * using functions like 'ORIGIN(RAM)' or 'LENGTH(RAM)'. + */ + +MEMORY +{ + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K + CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K + FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K + FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0 + EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0 + EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0 + EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0 + EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0 + MEMORY_ARRAY (xrw) : ORIGIN = 0x20002000, LENGTH = 32 +} + +/* + * For external ram use something like: + + RAM (xrw) : ORIGIN = 0x64000000, LENGTH = 2048K + + */ diff --git a/config/linker/sections.ld b/config/linker/sections.ld new file mode 100644 index 0000000..9ef139f --- /dev/null +++ b/config/linker/sections.ld @@ -0,0 +1,445 @@ +/* + * Default linker script for Cortex-M (it includes specifics for STM32F[34]xx). + * + * To make use of the multi-region initialisations, define + * OS_INCLUDE_STARTUP_INIT_MULTIPLE_RAM_SECTIONS for the _startup.c file. + */ + +/* + * The '__stack' definition is required by crt0, do not remove it. + */ +__stack = ORIGIN(RAM) + LENGTH(RAM); + +_estack = __stack; /* STM specific definition */ + +/* + * Default stack sizes. + * These are used by the startup in order to allocate stacks + * for the different modes. + */ + +__Main_Stack_Size = 1024 ; + +PROVIDE ( _Main_Stack_Size = __Main_Stack_Size ) ; + +__Main_Stack_Limit = __stack - __Main_Stack_Size ; + +/* "PROVIDE" allows to easily override these values from an + * object file or the command line. */ +PROVIDE ( _Main_Stack_Limit = __Main_Stack_Limit ) ; + +/* + * There will be a link error if there is not this amount of + * RAM free at the end. + */ +_Minimum_Stack_Size = 256 ; + +/* + * Default heap definitions. + * The heap start immediately after the last statically allocated + * .sbss/.noinit section, and extends up to the main stack limit. + */ +PROVIDE ( _Heap_Begin = _end_noinit ) ; +PROVIDE ( _Heap_Limit = __stack - __Main_Stack_Size ) ; + +/* + * The entry point is informative, for debuggers and simulators, + * since the Cortex-M vector points to it anyway. + */ +ENTRY(_start) + + +/* Sections Definitions */ + +SECTIONS +{ + /* + * For Cortex-M devices, the beginning of the startup code is stored in + * the .isr_vector section, which goes to FLASH. + */ + .isr_vector : ALIGN(4) + { + FILL(0xFF) + + __vectors_start = ABSOLUTE(.) ; + __vectors_start__ = ABSOLUTE(.) ; /* STM specific definition */ + KEEP(*(.isr_vector)) /* Interrupt vectors */ + + KEEP(*(.cfmconfig)) /* Freescale configuration words */ + + /* + * This section is here for convenience, to store the + * startup code at the beginning of the flash area, hoping that + * this will increase the readability of the listing. + */ + *(.after_vectors .after_vectors.*) /* Startup code and ISR */ + + } >FLASH + + .inits : ALIGN(4) + { + /* + * Memory regions initialisation arrays. + * + * Thee are two kinds of arrays for each RAM region, one for + * data and one for bss. Each is iterrated at startup and the + * region initialisation is performed. + * + * The data array includes: + * - from (LOADADDR()) + * - region_begin (ADDR()) + * - region_end (ADDR()+SIZEOF()) + * + * The bss array includes: + * - region_begin (ADDR()) + * - region_end (ADDR()+SIZEOF()) + * + * WARNING: It is mandatory that the regions are word aligned, + * since the initialisation code works only on words. + */ + + __data_regions_array_start = .; + + LONG(LOADADDR(.data)); + LONG(ADDR(.data)); + LONG(ADDR(.data)+SIZEOF(.data)); + + LONG(LOADADDR(.data_CCMRAM)); + LONG(ADDR(.data_CCMRAM)); + LONG(ADDR(.data_CCMRAM)+SIZEOF(.data_CCMRAM)); + + __data_regions_array_end = .; + + __bss_regions_array_start = .; + + LONG(ADDR(.bss)); + LONG(ADDR(.bss)+SIZEOF(.bss)); + + LONG(ADDR(.bss_CCMRAM)); + LONG(ADDR(.bss_CCMRAM)+SIZEOF(.bss_CCMRAM)); + + __bss_regions_array_end = .; + + /* End of memory regions initialisation arrays. */ + + /* + * These are the old initialisation sections, intended to contain + * naked code, with the prologue/epilogue added by crti.o/crtn.o + * when linking with startup files. The standalone startup code + * currently does not run these, better use the init arrays below. + */ + KEEP(*(.init)) + KEEP(*(.fini)) + + . = ALIGN(4); + + /* + * The preinit code, i.e. an array of pointers to initialisation + * functions to be performed before constructors. + */ + PROVIDE_HIDDEN (__preinit_array_start = .); + + /* + * Used to run the SystemInit() before anything else. + */ + KEEP(*(.preinit_array_sysinit .preinit_array_sysinit.*)) + + /* + * Used for other platform inits. + */ + KEEP(*(.preinit_array_platform .preinit_array_platform.*)) + + /* + * The application inits. If you need to enforce some order in + * execution, create new sections, as before. + */ + KEEP(*(.preinit_array .preinit_array.*)) + + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + + /* + * The init code, i.e. an array of pointers to static constructors. + */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + . = ALIGN(4); + + /* + * The fini code, i.e. an array of pointers to static destructors. + */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + } >FLASH + + /* + * For some STRx devices, the beginning of the startup code + * is stored in the .flashtext section, which goes to FLASH. + */ + .flashtext : ALIGN(4) + { + *(.flashtext .flashtext.*) /* Startup code */ + } >FLASH + + + /* + * The program code is stored in the .text section, + * which goes to FLASH. + */ + .text : ALIGN(4) + { + *(.text .text.*) /* all remaining code */ + + /* read-only data (constants) */ + *(.rodata .rodata.* .constdata .constdata.*) + + *(vtable) /* C++ virtual tables */ + + KEEP(*(.eh_frame*)) + + /* + * Stub sections generated by the linker, to glue together + * ARM and Thumb code. .glue_7 is used for ARM code calling + * Thumb code, and .glue_7t is used for Thumb code calling + * ARM code. Apparently always generated by the linker, for some + * architectures, so better leave them here. + */ + *(.glue_7) + *(.glue_7t) + + } >FLASH + + /* ARM magic sections */ + .ARM.extab : ALIGN(4) + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + . = ALIGN(4); + __exidx_start = .; + .ARM.exidx : ALIGN(4) + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + . = ALIGN(4); + _etext = .; + __etext = .; + + /* MEMORY_ARRAY */ + /* + .ROarraySection : + { + *(.ROarraySection .ROarraySection.*) + } >MEMORY_ARRAY + */ + + /* + * The secondary initialised data section. + */ + .data_CCMRAM : ALIGN(4) + { + FILL(0xFF) + *(.data.CCMRAM .data.CCMRAM.*) + . = ALIGN(4) ; + } > CCMRAM AT>FLASH + + /* + * This address is used by the startup code to + * initialise the .data section. + */ + _sidata = LOADADDR(.data); + + /* + * The initialised data section. + * + * The program executes knowing that the data is in the RAM + * but the loader puts the initial values in the FLASH (inidata). + * It is one task of the startup to copy the initial values from + * FLASH to RAM. + */ + .data : ALIGN(4) + { + FILL(0xFF) + /* This is used by the startup code to initialise the .data section */ + _sdata = . ; /* STM specific definition */ + __data_start__ = . ; + *(.data_begin .data_begin.*) + + *(.data .data.*) + + *(.data_end .data_end.*) + . = ALIGN(4); + + /* This is used by the startup code to initialise the .data section */ + _edata = . ; /* STM specific definition */ + __data_end__ = . ; + + } >RAM AT>FLASH + + /* + * The uninitialised data sections. NOLOAD is used to avoid + * the "section `.bss' type changed to PROGBITS" warning + */ + + /* The secondary uninitialised data section. */ + .bss_CCMRAM (NOLOAD) : ALIGN(4) + { + *(.bss.CCMRAM .bss.CCMRAM.*) + } > CCMRAM + + /* The primary uninitialised data section. */ + .bss (NOLOAD) : ALIGN(4) + { + __bss_start__ = .; /* standard newlib definition */ + _sbss = .; /* STM specific definition */ + *(.bss_begin .bss_begin.*) + + *(.bss .bss.*) + *(COMMON) + + *(.bss_end .bss_end.*) + . = ALIGN(4); + __bss_end__ = .; /* standard newlib definition */ + _ebss = . ; /* STM specific definition */ + } >RAM + + .noinit_CCMRAM (NOLOAD) : ALIGN(4) + { + *(.noinit.CCMRAM .noinit.CCMRAM.*) + } > CCMRAM + + .noinit (NOLOAD) : ALIGN(4) + { + _noinit = .; + + *(.noinit .noinit.*) + + . = ALIGN(4) ; + _end_noinit = .; + } > RAM + + /* Mandatory to be word aligned, _sbrk assumes this */ + PROVIDE ( end = _end_noinit ); /* was _ebss */ + PROVIDE ( _end = _end_noinit ); + PROVIDE ( __end = _end_noinit ); + PROVIDE ( __end__ = _end_noinit ); + + /* + * Used for validation only, do not allocate anything here! + * + * This is just to check that there is enough RAM left for the Main + * stack. It should generate an error if it's full. + */ + ._check_stack : ALIGN(4) + { + . = . + _Minimum_Stack_Size ; + } >RAM + + /* + * The FLASH Bank1. + * The C or assembly source must explicitly place the code + * or data there using the "section" attribute. + */ + .b1text : ALIGN(4) + { + *(.b1text) /* remaining code */ + *(.b1rodata) /* read-only data (constants) */ + *(.b1rodata.*) + } >FLASHB1 + + /* + * The EXTMEM. + * The C or assembly source must explicitly place the code or data there + * using the "section" attribute. + */ + + /* EXTMEM Bank0 */ + .eb0text : ALIGN(4) + { + *(.eb0text) /* remaining code */ + *(.eb0rodata) /* read-only data (constants) */ + *(.eb0rodata.*) + } >EXTMEMB0 + + /* EXTMEM Bank1 */ + .eb1text : ALIGN(4) + { + *(.eb1text) /* remaining code */ + *(.eb1rodata) /* read-only data (constants) */ + *(.eb1rodata.*) + } >EXTMEMB1 + + /* EXTMEM Bank2 */ + .eb2text : ALIGN(4) + { + *(.eb2text) /* remaining code */ + *(.eb2rodata) /* read-only data (constants) */ + *(.eb2rodata.*) + } >EXTMEMB2 + + /* EXTMEM Bank0 */ + .eb3text : ALIGN(4) + { + *(.eb3text) /* remaining code */ + *(.eb3rodata) /* read-only data (constants) */ + *(.eb3rodata.*) + } >EXTMEMB3 + + + /* After that there are only debugging sections. */ + + /* This can remove the debugging information from the standard libraries */ + /* + DISCARD : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + */ + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* + * DWARF debug sections. + * Symbols in the DWARF debugging sections are relative to the beginning + * of the section so we begin them at 0. + */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/config/linker/stm32_flash.ld b/config/linker/stm32_flash.ld deleted file mode 100755 index 7cfdc96..0000000 --- a/config/linker/stm32_flash.ld +++ /dev/null @@ -1,170 +0,0 @@ -/* -***************************************************************************** -** -** File : stm32_flash.ld -** -** Abstract : Linker script for STM32F407VG Device with -** 1024KByte FLASH, 192KByte RAM -** -** Set heap size, stack size and stack location according -** to application requirements. -** -** Set memory bank area and size if external memory is used. -** -** Target : STMicroelectronics STM32 -** -** Environment : Atollic TrueSTUDIO(R) -** -** Distribution: The file is distributed “as is,” without any warranty -** of any kind. -** -** (c)Copyright Atollic AB. -** You may use this file as-is or modify it according to the needs of your -** project. Distribution of this file (unmodified or modified) is not -** permitted. Atollic AB permit registered Atollic TrueSTUDIO(R) users the -** rights to distribute the assembled, compiled & linked contents of this -** file as part of an application binary file, provided that it is built -** using the Atollic TrueSTUDIO(R) toolchain. -** -***************************************************************************** -*/ - -/* Entry Point */ -ENTRY(Reset_Handler) - -/* Highest address of the user mode stack */ -_estack = 0x20020000; /* end of 128K RAM on AHB bus*/ - -/* Generate a link error if heap and stack don't fit into RAM */ -_Min_Heap_Size = 0; /* required amount of heap */ -_Min_Stack_Size = 0x400; /* required amount of stack */ - -/* Specify the memory areas */ -MEMORY -{ - FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K - RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K - MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K -} - -/* Define output sections */ -SECTIONS -{ - /* The startup code goes first into FLASH */ - .isr_vector : - { - . = ALIGN(4); - KEEP(*(.isr_vector)) /* Startup code */ - . = ALIGN(4); - } >FLASH - - /* The program code and other data goes into FLASH */ - .text : - { - . = ALIGN(4); - *(.text) /* .text sections (code) */ - *(.text*) /* .text* sections (code) */ - *(.rodata) /* .rodata sections (constants, strings, etc.) */ - *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ - *(.glue_7) /* glue arm to thumb code */ - *(.glue_7t) /* glue thumb to arm code */ - *(.eh_frame) - - KEEP (*(.init)) - KEEP (*(.fini)) - - . = ALIGN(4); - _etext = .; /* define a global symbols at end of code */ - } >FLASH - - - .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH - .ARM : { - __exidx_start = .; - *(.ARM.exidx*) - __exidx_end = .; - } >FLASH - - .preinit_array : - { - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array*)) - PROVIDE_HIDDEN (__preinit_array_end = .); - } >FLASH - .init_array : - { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array*)) - PROVIDE_HIDDEN (__init_array_end = .); - } >FLASH - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(.fini_array*)) - KEEP (*(SORT(.fini_array.*))) - PROVIDE_HIDDEN (__fini_array_end = .); - } >FLASH - - /* used by the startup to initialize data */ - _sidata = .; - - /* Initialized data sections goes into RAM, load LMA copy after code */ - .data : AT ( _sidata ) - { - . = ALIGN(4); - _sdata = .; /* create a global symbol at data start */ - *(.data) /* .data sections */ - *(.data*) /* .data* sections */ - - . = ALIGN(4); - _edata = .; /* define a global symbol at data end */ - } >RAM - - /* Uninitialized data section */ - . = ALIGN(4); - .bss : - { - /* This is used by the startup in order to initialize the .bss secion */ - _sbss = .; /* define a global symbol at bss start */ - __bss_start__ = _sbss; - *(.bss) - *(.bss*) - *(COMMON) - - . = ALIGN(4); - _ebss = .; /* define a global symbol at bss end */ - __bss_end__ = _ebss; - } >RAM - - /* User_heap_stack section, used to check that there is enough RAM left */ - ._user_heap_stack : - { - . = ALIGN(4); - PROVIDE ( end = . ); - PROVIDE ( _end = . ); - . = . + _Min_Heap_Size; - . = . + _Min_Stack_Size; - . = ALIGN(4); - } >RAM - - /* MEMORY_bank1 section, code must be located here explicitly */ - /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */ - .memory_b1_text : - { - *(.mb1text) /* .mb1text sections (code) */ - *(.mb1text*) /* .mb1text* sections (code) */ - *(.mb1rodata) /* read-only data (constants) */ - *(.mb1rodata*) - } >MEMORY_B1 - - /* Remove information from the standard libraries */ - /DISCARD/ : - { - libc.a ( * ) - libm.a ( * ) - libgcc.a ( * ) - } - - .ARM.attributes 0 : { *(.ARM.attributes) } -} diff --git a/source/application/drive_ctrl.c b/source/application/drive_ctrl.c index 7c951dc..c232a1d 100644 --- a/source/application/drive_ctrl.c +++ b/source/application/drive_ctrl.c @@ -40,30 +40,30 @@ int drive_ctrl_init(void) unsigned int duty = 0; /* open enable pins */ - open(drive_ctrl.left_forward->enable); - write(drive_ctrl.left_forward->enable, "0", 1); - open(drive_ctrl.left_backward->enable); - write(drive_ctrl.left_backward->enable, "0", 1); - open(drive_ctrl.right_forward->enable); - write(drive_ctrl.right_forward->enable, "0", 1); - open(drive_ctrl.right_backward->enable); - write(drive_ctrl.right_backward->enable, "0", 1); + drv_open(drive_ctrl.left_forward->enable); + drv_write(drive_ctrl.left_forward->enable, "0", 1); + drv_open(drive_ctrl.left_backward->enable); + drv_write(drive_ctrl.left_backward->enable, "0", 1); + drv_open(drive_ctrl.right_forward->enable); + drv_write(drive_ctrl.right_forward->enable, "0", 1); + drv_open(drive_ctrl.right_backward->enable); + drv_write(drive_ctrl.right_backward->enable, "0", 1); /* open pwm's */ - open(drive_ctrl.left_backward->pwm); - ioctl(drive_ctrl.left_backward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&duty); - open(drive_ctrl.left_forward->pwm); - ioctl(drive_ctrl.left_forward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&duty); - open(drive_ctrl.right_backward->pwm); - ioctl(drive_ctrl.right_backward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&duty); - open(drive_ctrl.right_forward->pwm); - ioctl(drive_ctrl.right_forward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&duty); + drv_open(drive_ctrl.left_backward->pwm); + drv_ioctl(drive_ctrl.left_backward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&duty); + drv_open(drive_ctrl.left_forward->pwm); + drv_ioctl(drive_ctrl.left_forward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&duty); + drv_open(drive_ctrl.right_backward->pwm); + drv_ioctl(drive_ctrl.right_backward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&duty); + drv_open(drive_ctrl.right_forward->pwm); + drv_ioctl(drive_ctrl.right_forward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&duty); /* enable enable pins */ - write(drive_ctrl.left_forward->enable, "1", 1); - write(drive_ctrl.left_backward->enable, "1", 1); - write(drive_ctrl.right_forward->enable, "1", 1); - write(drive_ctrl.right_backward->enable, "1", 1); + drv_write(drive_ctrl.left_forward->enable, "1", 1); + drv_write(drive_ctrl.left_backward->enable, "1", 1); + drv_write(drive_ctrl.right_forward->enable, "1", 1); + drv_write(drive_ctrl.right_backward->enable, "1", 1); return 0; } @@ -96,8 +96,8 @@ int drive_ctrl_set_speed_left(int speed_percent) { unsigned int front_speed = calc_speed_front(speed_percent); unsigned int back_speed = calc_speed_back(speed_percent); - int ret = ioctl(drive_ctrl.left_backward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&back_speed); - ret |= ioctl(drive_ctrl.left_forward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&front_speed); + int ret = drv_ioctl(drive_ctrl.left_backward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&back_speed); + ret |= drv_ioctl(drive_ctrl.left_forward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&front_speed); return ret; } @@ -106,8 +106,8 @@ int drive_ctrl_set_speed_right(int speed_percent) { unsigned int front_speed = calc_speed_front(speed_percent); unsigned int back_speed = calc_speed_back(speed_percent); - int ret = ioctl(drive_ctrl.right_backward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&back_speed); - ret |= ioctl(drive_ctrl.right_forward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&front_speed); + int ret = drv_ioctl(drive_ctrl.right_backward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&back_speed); + ret |= drv_ioctl(drive_ctrl.right_forward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&front_speed); return ret; } diff --git a/source/os/debug/include/board_devices.h b/source/os/debug/include/board_devices.h index caf7c12..ec42636 100644 --- a/source/os/debug/include/board_devices.h +++ b/source/os/debug/include/board_devices.h @@ -3,15 +3,14 @@ #ifndef BOARD_DEVICES_H #define BOARD_DEVICES_H -extern const struct driver gpio_d12; +extern const struct driver gpio_c0; +extern const struct driver gpio_c1; +extern const struct driver gpio_c2; +extern const struct driver gpio_c3; extern const struct driver pwm_4; extern const struct driver pwm_3; extern const struct driver pwm_2; extern const struct driver pwm_1; extern const struct driver uart_1; -extern const struct driver gpio_c0; -extern const struct driver gpio_c1; -extern const struct driver gpio_c2; -extern const struct driver gpio_c3; #endif /* BOARD_DEVICES_H */ diff --git a/source/os/debug/libkosmos-arm-stm32f4-discovery-0.1.0-dbg.a b/source/os/debug/libkosmos-arm-stm32f4-discovery-0.1.1-dbg.a similarity index 90% rename from source/os/debug/libkosmos-arm-stm32f4-discovery-0.1.0-dbg.a rename to source/os/debug/libkosmos-arm-stm32f4-discovery-0.1.1-dbg.a index 0d87fd7320645acc5716ab5d05b3056a25e42625..89d74e5e097edf314f2f7f44163dec44ff548785 100644 GIT binary patch delta 12826 zcmc&*3wRaPwO%vl?pv2fRZOfqK^Dk#c)-^!l# z@Aa>>_TFpH%$fPJc~8dvKV>vz=;3H6T$q*R&!UI@Z&p^YI1~;td}cg=b1p#5|8ZHe z6~Hd~F9GbbLItp7)gA!5tlkD-6j`EMCtbI@1^{#=d;bPt$s5lCbS3ZA0m$+p^6YX< zzXssgMHKyF2FKX?g&e)2{0+`i^iD$0I#8(eJ_U+Tjg_n!pis&Ef=hu16e|9npcDqr zlu`RZk>#p*P|gs&EATwA1&cvBA6a<~D3<8f$%SY)Tnfs0ihc&+#Z*wfi5&b5C})$l zJ3)yRT>n_$-1PQJP|i`*xczW;(f?DY=u4{u6$|exrPu?iC8N;(Ttq(?BWg2GJ%3r6 z3~E=hb|I)jbn7Ih-8K=_3oWnB1NBVNy8^#MOz$!)mVjg6X86`cw}OmK1;_bF#oOSx z0HVh@S+0UZmWOk|aiQd?ec*@{T?Wog|IM4=_&V~|Y;eSgE(71P{`nW+pmJ(67u`Df z8m-g454x0o9&nzc=w}!f-w94jN>jmkzA~X7IL}@5uQslU2j{mYc>g~y=a2sooEK8` zuAII1AUMB?oO~Oc=P3HQ8g^wDS26&;q394dzTZU@{bB~k*!sm9{U8G~EBLY2UIen*pw~iEi&$y&hZ_LY}+^T<0iyhv5rF;QH=G|N23X{WrKQ z`D7os?D8+HCA*x$!3oivTcJY|^y8orMw?#mduFx+6poCB@M`!y-XFuyjk^|BT7oy;QI zx?|Omj?UI6R{I%Vw!yVM5$WPj8yiR|hC`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