2016-11-24 06:45 PM
Dear Sir,
Take a look the global constant contained in comdef.h.typedef unsigned char boolean; /* Boolean value type. */typedef unsigned int uint32; /* Unsigned 32 bit value */typedef unsigned short uint16; /* Unsigned 16 bit value */typedef unsigned char uint8; /* Unsigned 8 bit value */typedef signed int int32; /* Signed 32 bit value */typedef signed short int16; /* Signed 16 bit value */typedef signed char int8; /* Signed 8 bit value */typedef float FP32; /* Single precision floating point */typedef double FP64; /* Double precision floating point */typedef unsigned char bool; /* Boolean value type. *///typedef unsigned int uint32_t; /* Unsigned 32 bit value *///typedef unsigned short uint16_t; /* Unsigned 16 bit value *///typedef unsigned char uint8_t; /* Unsigned 8 bit value *///typedef signed int int32_t; /* Signed 32 bit value *///typedef signed short int16_t; /* Signed 16 bit value *///typedef signed char int8_t; /* Signed 8 bit value */Its clear from this section that, uint16_t; is kept inactive.Now look at my Private variables called in C main,uint16_t LED1_Status=0;uint16_t LED2_Status=0;uint16_t LED5_Status=0;uint16_t LED6_Status=0;Is it okay? Why then?RegardsHasan2016-11-25 02:35 AM
uint16_t and similar are types required by the C standard. They are defined in <stdint.h> - you probably #include that header indirectly through other system headers such as <stdio.h>, or the build system you are using is doing that for you.
JW2016-11-25 07:23 AM
[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/Why%20comdef.h%20need%20for%20stm32f070xx%20%20not%20working%21&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/AllItems.aspx¤tviews=41]Duplicative thread topic.
I'm not sure you understand the purpose of the typedef's and that types might be defined in multiple places depending on what include files are pulled in, and what's in them. If you have a lot of conflicting definitions you need to clean up things so there is the consistent application of one or two include files containing unique types that bridge the gap between what the standard include files are pulling in, and what you need to get closure in the rest of your code base. I'd recommend getting a complete understanding of your source, and then refactoring that into your new implementation, cleaning things up as you pull across various parts.2016-11-27 07:58 PM
''I'm not sure you understand the purpose of the typedef's and that types might be defined in multiple places depending on what include files are pulled in, and what's in them.''
I agree with you, but when you say 'multiple places' seems thousands of codes have to find. Applying Keil, what tools do you suggest ?''If you have a lot of conflicting definitions you need to clean up things so there is the consistent application of one or two include files containing unique types''Are you talking about typedef's definitions? Number of unique files are more, what should I do then? Many typedefs are conflicting, ../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_rcc_ex.h(2051): error: #20: identifier ''HAL_StatusTypeDef'' is undefined''refactoring that into your new implementation''Do you want me to broke my application code into different part ?Getting started things are time consuming.Kindly give your comments on '' sate file/global file dependencies on main''Dont you think, global constant in HAL, stdint.h and elsewhere should be same?
2016-11-27 08:38 PM
If you want me responding into different threads, provide a clickable link not a title.
Don't make this about Keil, all compilers are dependent on the files you provide and their interactions with ''standard'' files you might also include that come with the tool-chain. Something that has implementation specific dependencies, say ones from MSVC or GNU/GCC might not work immediately in IAR or Keil. In porting between tool-chains you must addresses these differences. An issue with ''HAL_StatusTypeDef'' is most likely due to defines (USE_HAL_DRIVER,HAL_MODULE_ENABLED
) or settings in stm32f0xx_hal_conf.h in your project tree, via stm32f0xx.h I think you'd want your types to be consistent. If they are divergent within the source this is something you'd need to localize, so as not to include two conflicting schemes, and look to refactor into a more consistent approach. I'm suggesting you review your project files, and any metadata (include paths, compiler defines, etc), so you can migrate from CooCox to Keil, etc. If you understand the source and build process for CooCox you should be able to move that to a different tool-chain.2016-11-27 09:18 PM
Lets talk about ARMCC in Keil, one mdk-keil person says
http://www.keil.com/forum/61945/#/msg202739
He believe for the case of embedded processor COM file may not support, or he might be misunderstood what I have represent.'' If they are divergent within the source this is something you'd need to localize, so as not to include two conflicting schemes, and look to refactor into a more consistent approach.''
Do you want me to read ''ARM Compiler v5.06 for µVision Getting Started Guide'' orµVision User's Guide ?
2016-11-27 09:43 PM
HAL_MODULE_ENABLED
) or settings in stm32f0xx_hal_conf.h in your project tree, via stm32f0xx.h''Take a look things stays in stm32f0xx_hal_conf.h,#define HAL_MODULE_ENABLED /*#define HAL_ADC_MODULE_ENABLED *//*#define HAL_CAN_MODULE_ENABLED *//*#define HAL_CEC_MODULE_ENABLED *//*#define HAL_COMP_MODULE_ENABLED *//*#define HAL_CRC_MODULE_ENABLED *//*#define HAL_CRYP_MODULE_ENABLED *//*#define HAL_TSC_MODULE_ENABLED *//*#define HAL_DAC_MODULE_ENABLED *//*#define HAL_I2S_MODULE_ENABLED *//*#define HAL_IWDG_MODULE_ENABLED *//*#define HAL_LCD_MODULE_ENABLED *//*#define HAL_LPTIM_MODULE_ENABLED *//*#define HAL_RNG_MODULE_ENABLED *//*#define HAL_RTC_MODULE_ENABLED */#define HAL_SPI_MODULE_ENABLED/*#define HAL_TIM_MODULE_ENABLED *//*#define HAL_UART_MODULE_ENABLED *//*#define HAL_USART_MODULE_ENABLED *//*#define HAL_IRDA_MODULE_ENABLED *//*#define HAL_SMARTCARD_MODULE_ENABLED *//*#define HAL_SMBUS_MODULE_ENABLED *//*#define HAL_WWDG_MODULE_ENABLED *//*#define HAL_PCD_MODULE_ENABLED */#define HAL_CORTEX_MODULE_ENABLED#define HAL_DMA_MODULE_ENABLED#define HAL_FLASH_MODULE_ENABLED#define HAL_GPIO_MODULE_ENABLED#define HAL_PWR_MODULE_ENABLED#define HAL_RCC_MODULE_ENABLED#define HAL_I2C_MODULE_ENABLED ..................................................................................................................................................................My error output indicates, ( showing few of them)../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_rcc_ex.h(2051): error: #20: identifier ''HAL_StatusTypeDef'' is undefined HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_dma.h(134): error: #20: identifier ''HAL_LockTypeDef'' is undefined HAL_LockTypeDef Lock; /*!< DMA locking object */ ../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_dma.h(456): error: #20: identifier ''HAL_StatusTypeDef'' is undefined HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma); What exception do you feel from errors compared to HAL configuration?
2016-11-28 08:35 PM
You need to review the defines passed by the compiler. To reiterate, review a working HAL/Cube project and understand the construction of that project, including all settings and metadata.
Use ''Find in Files'' to determine which of the source/include files contains the definitions/typedefs you are missing, then work back up the include file to see what preprocessor defines allow/enable the content being pulled in, and the chain of files that gets you there. I'm not using HAL, and not really looking to wade into your library/implementation choices. You will need to discuss this with your colleagues and/or supervisor. If you have issues with HAL and comdef.h conflicting, then partition the code in such a fashion that they don't touch. ie create an abstraction and API so you can separate them.2016-11-28 09:19 PM
I do agree with you and one ARM KEIL application engineer said that errors induced from cubemx. I beg pardon, where do you get metadata folder in mdk-keil? I saw it in Ecilipse workplace!Are you talking about output files? Let me know where it could be appear in mdk-keil project.''Use ''Find in Files'' to determine which of the source/include files contains the definitions/typedefs you are missing, then work back up the include file to see what preprocessor defines allow/enable the content being pulled in, and the chain of files that gets you there.''
Good way this one! In pre processor setting, its written -c --cpu Cortex-M0 -D__RTX -g -O3 --apcs=interwork --split_sections --asm --interleave --asm_dir ''.\\'' -I ../Inc -I ../Drivers/STM32F0xx_HAL_Driver/Inc -I I am using --C99 control, not C99 mode.One very unknown sign appears in my main.c, at condition, if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK),The system says,'' implicit declaration of function HAL_RCC_OscConfig that is invalid in C99''
''You will need to discuss this with your colleagues and/or supervisor.''
Nobody knows firmware code even its stm,TI, or basic c! I am circuit design engineer.''create an abstraction and API so you can separate them.'' Kindly, give me an example or related document or reference.
2016-11-29 07:53 AM
My degree is in Electrical and Electronic Engineering.
You might want to review texts for Software Engineering and C Programming. There is a lot of material available, you'll need to find what suits your needs/experience.Try to localize your use of comdef.h to places you actually need it, and understand what specific parts of it are required by your other code. Discuss/consult with the people who wrote the code.Your compiler command line still does not seem to be using the USE_HAL_DRIVER define, or one for the STM32F0xx part you are using. Review the setting in your CooCox project with some more rigour, and apply them to the Keil project. Review working HAL/CubeMX projects for your platform. Start with something simple so you don't get lost in the complexity.