Jump to content

Recommended Posts

Posted

Hello,

I'm trying to get µGFX running on bare metal while using Keil µVision 5.13.

I have almost everything compiling, except 1 problem with _setjmp():

.\Targets\STM32F4_Discovery\project.axf: Error: L6218E: Undefined symbol _setjmp (referred from gos_raw32.o).

in gos_raw32.c this is defined:


#include /* jmp_buf, setjmp(), longjmp() */

#ifndef setjmp
#ifndef _setjmp
#define _setjmp setjmp
#endif
#endif

setjmp.h is coming from \Keil_v5\ARM\ARMCC\include\setjmp.h

Here is already setjmp defined:

#define setjmp(jmp_buf) (__CLIBNS setjmp(jmp_buf))

What am I doing wrong? I have the option to comment out the #ifndef setjmp .. #endif from gos_raw32.c, then it compiles, but I don't want to mess in that code.

Anybody an idea what I do best?

Thanks!

Posted

I have pushed a small change to the master repository that will hopefully fix the issue with the Kiel compiler for you.

Can you please try it and let me know if it works and if not then what changes are needed to make it work.

Posted

Not really, because setjmp is defined by Keil (\ARM\ARMCC\include\setjmp.h), so it never reaches the #define _setjmp setjmp and gos_raw32.c needs _setjmp()

#if !defined(__KEIL__) && !defined(__C51__)
#ifndef setjmp
#ifndef _setjmp
#define _setjmp setjmp
#endif
#endif
#ifndef longjmp
#ifndef _longjmp
#define _longjmp longjmp
#endif
#endif
#endif

Something like this would work better for me:

#if !defined(__KEIL__) && !defined(__C51__)
#if !defined(setjmp) && !defined(_setjmp)
#define _setjmp setjmp
#endif
#if !defined(longjmp) && !defined(_longjmp)
#define _longjmp longjmp
#endif
#else
#if !defined(_setjmp)
#define _setjmp setjmp
#endif
#if !defined(_longjmp)
#define _longjmp longjmp
#endif
#endif

Sorry, but one more issue/error I forgot about.

..\00-uGFX\src/gos/gos_raw32.h(47): error: #256: invalid redeclaration of type name "int8_t" (declared at line 56 of "C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h")

Because of this error, I commented out this (src/gos/gos_raw32.h) : typedef char int8_t;

#ifndef _STDINT_H
// typedef char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
#endif

This would work:

#ifndef _STDINT_H
#if !defined(__KEIL__) && !defined(__C51__)
typedef char int8_t;
#endif
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
#endif

But maybe I'm missing something?

Thanks!

Posted

I will update the master with the changes to the setjmp.

Thanks for that.

With the int8_t, all that block should not be defined if stdint.h has been included as all those definitions should come from that file.

I suspect that all the other defines are matching and so they don't give a warning whereas Keil has some funny ideas about char signed-ness (or not).

A better solution is to check the top of stdint.h from Keil and change the block to be:


#if !defined(_STDINT_H) && !defined( the appropriate symbol that kiel uses at the top of stdint.h )
typedef char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
#endif

Can you please get back to me on the correct symbol for that.

Thanks.

Posted

Well, no, sorry. I noticed it before in your comments, but the company is called Keil, not Kiel. So the definition needs to be "__KEIL__" and not "__KIEL__" :)

  • 2 weeks later...
Posted

Hello! I new member and I try port uGFX to KEIL for use with STM32 my project build is done, but once I run debug step - mode in this line

_setjmp(pframeinfo->cxt);

I go to HardFault_Handler...

I used source for _setjmp in this thread which provided Mr.GunterO

#if !defined(__KEIL__) && !defined(__C51__)
#if !defined(setjmp) && !defined(_setjmp)
#define _setjmp setjmp
#endif
#if !defined(longjmp) && !defined(_longjmp)
#define _longjmp longjmp
#endif
#else
#if !defined(_setjmp)
#define _setjmp setjmp
#endif
#if !defined(_longjmp)
#define _longjmp longjmp
#endif
#endif

Because source which provided in lib "ugfx_release_22_150104" not build in Keil.

I do not know what I'm doing wrong, why the code does not work ((

Please help me, or if you have template project for Keil please give me for I compared in my project and find my wrong way.

P.S. Sorry for my English I live in Ukraine...

Thanks.

Posted

Please use the current master repository as there have been many bug fixes and changes since 2.2. This should fix your Keil compile issues as the current master is known to work with Keil.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...