반응형

1. 개발 환경 설치

1.1. JDK (Java Development Kit) 설치

1.2. GNU Arm Embedded Toolchain 설치

1.3. 이클립스 (Eclipse) IDE 설치

1.3.1. Eclipse CDT용 플러그인 설치

1.3.2. GNU MCU Eclipse 설치 – STM32F series firmware compile 

1.3.3.  cygwin 설치 - 내용 추가

 

1.1. JDK (Java Development Kit)

(1) Java platform으로 구동되는 이클립스 (Eclipse) 통합 개발 환경에서 GCC compile 관련 개발 및 실행하기 위해 JDK (Java Development Kit) 설치를 필요로 하며, 기존에 설치 되어 있을 경우 생략하여도 된다.

 

(2) 아래 경로에 접속을 하여서 JDK 관련 Setup 파일을 다운로드 한다.

https://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html#javasejdk

 

(3)  Accept License Agreement 라디오 버튼을 클릭 후, “jdk-13.0.1_windows-x64_bin.exe”를  다운로드 한 후에 해당 파일을 실행하여 설치 프로세스를 진행한다.

 

(4) 위와 같이 정상적으로 설치 프로세스를 진행하여 JDK 관련 설치를 종료한다. 

 

1.2. GNU Arm Embedded Toolchain 설치

 (1) Windows 환경에서 GCC 컴파일을 하기 위해 GNU Arm Embedded Toolchain 관련 설치를 진행해야 하며, 아래 경로에서 해당 다운로드를 하여 관련 GCC 컴파일 환경 설정을 한다.
[GNU Arm Embedded Toolchain : ARM
용 compiler, Linker, Debugger 등이 포함된 Toolchain]

https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm

 

(2) 해당 경로의 web page에서 “GNU-RM” 리스트 박스를 선택하여 ‘Downloads’ page로 이동을 한다.

(3) ‘Downloads’ page에서 가장 최신 versionGNU Arm Embedded Toolchain을 다운로드한다.
※ 작성 시점의 version : GNU Arm Embedded Toolchain: 9-2019-q4-major November 06, 2019

(4) Windows 32-bit installer typeWindows 32-bit ZIP package type를 선택하여 Toolchain 환경을 설치할 수가 있는데, ‘gcc-arm-none-eabi-9-2019-q4-major-win32.zip’를 선택하여 관련 설정을 하도록 한다.

 

(5) Windows 32-bit ZIP package을 원하는 폴더에 다운로드 하고 압축 해제를 한다.

(6) GNU Arm Embedded Toolchain 경로 설정을 위해 사용자 PC의 시스템 속성의 환경변수 탭을 선택한다.

 

 (7) 환경변수의 시스템 변수(S)’ 항목에서 새로 만들기(W)’을 선택하여 변수 이름에는 ‘gcc-arm-none-eabi’를 입력하고, 변수 값에는 아래와 같이 GNU Arm Embedded Toolchain을 압축 해제한 경로를 입력하고 확인 버튼을 누른다.

 

(8) 이어서 환경변수의 시스템 변수(S) -> Path 변수항목의 편집을 선택하고, Path 환경변수 편집 창에서 새로 만들기를 누른 후에 ‘%gcc-arm-none-eabi%\bin’를 입력한다.

 

(9) 위와 같이 환경변수 관련 설정을 마치면, 아래와 같이 Command Window에서 ‘arm-none-eabi-gcc --version’를 실행하여 정상적으로 GNU Arm Embedded toolchain이 설정되어 있는지 확인할 수가 있다.

 

 

1.3. 클립스 (Eclipse) IDE 설치

 (1) GNU Arm Embedded Toolchain 환경에서 STM32F series firmwaregcc compiler 환경에서 compile를 하기위해 이클립스 (Eclipse) IDE를 설치해야 한다. 아래 경로에서 이클립스 IDE 설치 파일을 다운로드 한다.

https://www.eclipse.org/downloads/packages/release/2019-12/r
 

(2) 위의 사이트에서 ‘Eclipse IDE for C/C++ Developers’ 설치 파일을 다운 받는다.

 

(3) 위의 Eclipse portable 실행 파일을 원하는 디렉토리에 다운로드를 하고 ‘eclipse.exe’를 실행하면 아래와 같은 화면이 나타나며, 사용자 임의 ‘workspace’를 설정한다.

 

(4) 아래 그림은 정상적으로 Eclipse IDE 환경이 실행된 화면이다.

 

 

1.3.1.      Eclipse CDT용 플러그인 설치

Eclipse C/C++뿐만 아니라 다양한 프로그래밍 언어 및 대상 플랫폼 개발 환경을 지원하며, ARM GCC를 위한 플러그-인을 추가로 설치한다. 참고로 Install New software 및 Eclipse marketplace에서 아래 플러그인들을 추가설치 하면, 대부분의 사이트에서 안내하는 ‘GNU MCU Eclipse - window build tool 설치’ 절차를 생략하여도 된다.

 

(1) Eclipse를 실행 후,

(2) 메뉴 항목, Help > Install New Software 선택 하면 ‘Install’ 창이 나타난다.

 

(3) ‘Work with’ 탭박스의 ‘Available Software Site’를 누르면 여러 사이트 주소창이 나오는데 아래 항목 선택

 

     "CDT - http://download.eclipse.org/tools/cdt/releases/9.10"

 

(4) 잠시 기다리면 CDT Main Features CDT Optional Features가 나오는데 순차적으로 선택을 한다.

 

# CDT Main Features     

▣ C/C++ Development Tools SDK 9.10.0.201912051559

 

# CDT Optional Features

▣ C/C++ Autotools support Developer Resources   9.10.0.201911192140

▣ C/C++ C99 LR Parser  9.10.0.201910281707

▣ C/C++ GCC Cross Compiler Support Developer Resources 9.10.0.201910171407

▣ C/C++ GDB Hardware Debugging Developer Resources   9.10.0.201911010936

▣ C/C++ Memory View Enhancements Developer Resources 9.10.0.201910171407

 

(5) ‘I accept the terms of the license agreement’를 선택하고 ‘Finish’를 누르면 Eclipse software 실행 화면 우측 하단에 아래와 같이 install progress bar를 확인할 수가 있다.

 

(6) 정상적으로 Eclipse IDE Install software 설치 완료 되었으면, 아래와 같은 창이 나타나는데 ‘Restart Now’를 선택해서 재시작을 한다.

 

 

1.3.2.      GNU MCU Eclipse 설치 – STM32F series firmware compile

(1) C/C++ Development Tools SDK 플러그인 설치 완료 후, GNU MCU Eclipse 관련 설치가 필요하며, 이를 설치하기 위해 메뉴 항목의 Help > Eclipse Marketplace를 선택한다.

(2) ‘Eclipse Marketplace’ 창의 ‘Search-Find’ 항목에 ‘GNU-MCU’를 입력하면 다음과 같이 검색이 된다.

 

(3)   ‘GNU MCU Eclipse 4.7.1’ 설치 항목은 대부분 설치를 하는 것을 권장하며 모두 선택한 후에 ‘Confirm’을 선택한다.

 

(4) ‘I accept the terms of the license agreement’를 선택하고 ‘Finish’를 누르고 정상적으로 설치가 되면 다음과 같은 창이 나타나는데 ‘Restart Now’를 선택하면 된다.

 

 

1.3.3.      Cygwin 설치

새로운 PC에 위의 과정(To. 1.3.2)을 최신 version 설치하면서, 기존 프로젝트를 불러온 후에, 아래와 같은 에러 메세지가 나타나면서 compile이 안되는 문제가 있었다.

 

C / C++ IDE (CDT) » "make" is not found in PATH hello( "make" is not found in PATH hello)

 

아래와 같은 프로그램으로 리눅스 관련 명령어가 실행되도록 해야한다. 아래 사이트에 가서 설치하고, 환경설정을 하여주면된다.

https://www.cygwin.com/

 

Cygwin

Cygwin Get that Linux feeling - on Windows This is the home of the Cygwin project What... ...is it? Cygwin is: a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows. a DLL (cygwin1.dll) which

www.cygwin.com

 글을 남기는 시점에서 개발환경의 Version 은 아래와 같다.

 

반응형
반응형

Eclipse IDE 환경에서 printf() 함수 사용시에는 아래와 같이 hwconfig.c 에서 정의해야 한다.

 

#ifdef __GNUC__
	/* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf
	 set to 'Yes') calls __io_putchar() */
	#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
	#define GETCHAR_PROTOTYPE int __io_getchar(int ch)
#else
	#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
	#define GETCHAR_PROTOTYPE int fgetc(FILE *f)
#endif /* __GNUC__ */

PUTCHAR_PROTOTYPE		// for printf use USART1
{
	// Write a character to the USART
	if( ch == '\n')
	{
		USART_SendData(USART1, '\r');
		while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
		USART_SendData(USART1, '\n');
	}
	else
	{
		USART_SendData(USART1, (uint8_t) ch);
	}

	// Loop until the end of transmission
	while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);

	return ch;
}

GETCHAR_PROTOTYPE		// for printf use USART1
{
	while (USART_GetFlagStatus(USART1, USART_FLAG_RXNE) == RESET){}; 
	return USART_ReceiveData(USART1);
}

그리고 특정 source file에 printf() 함수를 추가하고 build를 진행하면 아래와 같이 compile error가 발생하는데, 이 부분은 gcc compile system의 standard I/O function call에 따른 이슈로 인하여 발생되는 문제이며, 해결 방안은 syscalls.c 파일을 프로젝트에 추가하여 함께 build 하면 된다. (참고로 IAR compiler 환경에서는 해당 printf() 함수 사용 할 경우 optimization linking 및 compile 되어 build image가 생성된다.)

 

# compile error case

/usr/lib/gcc/arm-none-eabi/4.9.1/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function `exit':
/build/arm-none-eabi-gcc/src/gcc-4.9.1/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'
/usr/lib/gcc/arm-none-eabi/4.9.1/../../../../arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
/build/arm-none-eabi-gcc/src/gcc-4.9.1/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/sbrkr.c:58: undefined reference to `_sbrk'
/usr/lib/gcc/arm-none-eabi/4.9.1/../../../../arm-none-eabi/lib/libc.a(lib_a-writer.o): In function `_write_r':
/build/arm-none-eabi-gcc/src/gcc-4.9.1/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/writer.c:58: undefined reference to `_write'
/usr/lib/gcc/arm-none-eabi/4.9.1/../../../../arm-none-eabi/lib/libc.a(lib_a-closer.o): In function `_close_r':
/build/arm-none-eabi-gcc/src/gcc-4.9.1/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/closer.c:53: undefined reference to `_close'
/usr/lib/gcc/arm-none-eabi/4.9.1/../../../../arm-none-eabi/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r':
/build/arm-none-eabi-gcc/src/gcc-4.9.1/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/fstatr.c:62: undefined reference to `_fstat'
/usr/lib/gcc/arm-none-eabi/4.9.1/../../../../arm-none-eabi/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r':
/build/arm-none-eabi-gcc/src/gcc-4.9.1/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/isattyr.c:58: undefined reference to `_isatty'
/usr/lib/gcc/arm-none-eabi/4.9.1/../../../../arm-none-eabi/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r':
/build/arm-none-eabi-gcc/src/gcc-4.9.1/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/lseekr.c:58: undefined reference to `_lseek'
/usr/lib/gcc/arm-none-eabi/4.9.1/../../../../arm-none-eabi/lib/libc.a(lib_a-readr.o): In function `_read_r':
/build/arm-none-eabi-gcc/src/gcc-4.9.1/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/readr.c:58: undefined reference to `_read'
collect2: error: ld returned 1 exit status

# syscall.c 새로 정의

#include <_ansi.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <sys/times.h>
#include <errno.h>
#include <reent.h>
#include <unistd.h>
#include <sys/wait.h>

#define FreeRTOS
#define MAX_STACK_SIZE 0x2000

extern int __io_putchar(int ch) __attribute__((weak));
extern int __io_getchar(void) __attribute__((weak));

#ifndef FreeRTOS
  register char * stack_ptr asm("sp");
#endif

caddr_t _sbrk(int incr)
{
  extern char end asm("end");
  static char *heap_end;
  char *prev_heap_end,*min_stack_ptr;

  if (heap_end == 0)
    heap_end = &end;

  prev_heap_end = heap_end;

#ifdef FreeRTOS
  /* Use the NVIC offset register to locate the main stack pointer. */
  min_stack_ptr = (char*)(*(unsigned int *)*(unsigned int *)0xE000ED08);
  /* Locate the STACK bottom address */
  min_stack_ptr -= MAX_STACK_SIZE;

  if (heap_end + incr > min_stack_ptr)
#else
  if (heap_end + incr > stack_ptr)
#endif
  {
//    write(1, "Heap and stack collision\n", 25);
//    abort();
    errno = ENOMEM;
    return (caddr_t) -1;
  }

  heap_end += incr;

  return (caddr_t) prev_heap_end;
}

/*
 * _gettimeofday primitive (Stub function)
 * */
int _gettimeofday (struct timeval * tp, struct timezone * tzp)
{
  /* Return fixed data for the timezone.  */
  if (tzp)
    {
      tzp->tz_minuteswest = 0;
      tzp->tz_dsttime = 0;
    }

  return 0;
}
void initialise_monitor_handles()
{
}

int _getpid(void)
{
  return 1;
}

int _kill(int pid, int sig)
{
  errno = EINVAL;
  return -1;
}

void _exit (int status)
{
  _kill(status, -1);
  while (1) {}
}

int _write(int file, char *ptr, int len)
{
  int DataIdx;

    for (DataIdx = 0; DataIdx < len; DataIdx++)
    {
       __io_putchar( *ptr++ );
    }
  return len;
}

int _close(int file)
{
  return -1;
}

int _fstat(int file, struct stat *st)
{
  st->st_mode = S_IFCHR;
  return 0;
}

int _isatty(int file)
{
  return 1;
}

int _lseek(int file, int ptr, int dir)
{
  return 0;
}

int _read(int file, char *ptr, int len)
{
  int DataIdx;

  for (DataIdx = 0; DataIdx < len; DataIdx++)
  {
    *ptr++ = __io_getchar();
  }

   return len;
}

int _open(char *path, int flags, ...)
{
  /* Pretend like we always fail */
  return -1;
}

int _wait(int *status)
{
  errno = ECHILD;
  return -1;
}

int _unlink(char *name)
{
  errno = ENOENT;
  return -1;
}

int _times(struct tms *buf)
{
  return -1;
}

int _stat(char *file, struct stat *st)
{
  st->st_mode = S_IFCHR;
  return 0;
}

int _link(char *old, char *new)
{
  errno = EMLINK;
  return -1;
}

int _fork(void)
{
  errno = EAGAIN;
  return -1;
}

int _execve(char *name, char **argv, char **env)
{
  errno = ENOMEM;
  return -1;
}

결론적으로 상용 컴파일러를 사용하지 않고, Eclipse IDE와 같은 무료 프로그램으로 충분히 compile를 할 수 있다는 것에 고무적인 결과이다. 조만간 STM32F103x processor를 사용한 hardware platform 기반 Eclipse IDE 환경에서의 setup guide post를 남겨보도록 하겠다.

 

참고로 일반적으로 잘 알려진 디버깅용 printf() 함수 사용과 비슷한 구현을 아래와 같이 공유한다.

 

void zPrintf(USART_TypeDef* usart_p, char *fmt, ...)
{
	va_list	arg_ptr;
	char		LocalText[64];
	uint8_t	cnt;
	
	for(cnt=0 ; cnt<64 ; cnt++) 
	{
		LocalText[cnt] = 0x00;
	}

	va_start(arg_ptr, fmt);
	vsprintf(LocalText, fmt, arg_ptr);
	va_end(arg_ptr);

	for(cnt=0 ; cnt<64 ; cnt++) 
	{
		if(LocalText[cnt] != 0)
		{
			USART_SendData(usart_p, LocalText[cnt]);
			while(USART_GetFlagStatus(usart_p, USART_FLAG_TXE) == RESET);
			
			if(LocalText[cnt] == KEYBOARD_LineFeed)
			{
				USART_SendData(usart_p, KEYBOARD_CarryRet);
				while(USART_GetFlagStatus(usart_p, USART_FLAG_TXE) == RESET);
			}
		}
		else		break;
	}	
}
반응형
반응형

Magnetic Sensor Evaluation Demo Program [MFC Version]



위에서 새로운 UI가 적용된 Magnetic Sensor Evaluation Demo Program을 만들라고 하셔서, MFC 전혀 개발하지도 않은 초보자가 개발 4일만에 완성시킨 작품!

맨날 Embedded Firmware 기반에서 Hard Coding만 하다가, 그래픽 인터페이스가 들어간 Application Program을 만드려고 하니까, 얼마나 힘이 들었던지.. ㅎㅎ

4일동안 밤을 새가면서, 구글과 네이버를 적극적으로 활용을 하고나니, 윗분들이 원하는 프로그램이 나오게 되었다.

이 프로그램에 대한 구현 사항은 다음과 같다.


- CThread를 활용한 시리얼 통신 자동 접속 기능

- CBitmap을 활용한 나침반 이미지 투명하게 회전

- CPen을 활용한 프로그레스바 기능

- CGraph을 활용한 그래프 기능

- 전체적인 UI


얼핏보면 가벼운 기능같아 보이겠지만, 나름 퍼포먼스 구현하는데 상당히 애를 먹었다는.. ㅎㅎ

이에 대하여 궁금한 사항이 있다면 댓글 달아주세요.

그럼 관련 부분에 대하여 부분 소스 공개를 해드리겠습니다.


아래 링크는 실행 파일 다운

반응형
반응형

David Veksle does an excellent job of describing them:

A programmer spends about 10-20% of his time writing code, and most programmers write about 10-12 lines of code per day that goes into the final product, regardless of their skill level. Good programmers spend much of the other 90% thinking, researching, and experimenting to find the best design. Bad programmers spend much of that 90% debugging code by randomly making changes and seeing if they work. [...]

Great programmers spend very little of their time writing code – at least code that ends up in the final product. Programmers who spend much of their time writing code are too lazy, too ignorant, or too arrogant to find existing solutions to old problems. Great programmers are masters at recognizing and reusing common patterns. Good programmers are not afraid to refactor (rewrite) their code constantly to reach the ideal design. Bad programmers write code which lacks conceptual integrity, non-redundancy, hierarchy, and patterns, and so is very difficult to refactor. It’s easier to throw away bad code and start over than to change it.

Yes, I realize this is one of the self-congratulatory articles that programmers write when they want to describe themselves. But it is still useful to know how good programmers do their work. On the other hand, it is perhaps more useful to understand how some programmers never manage to channel years of experience into writing good code.

There are many kinds of mistakes made by software developers, but the “jump directly into coding and stay coding” is perhaps one of the most common. The reason being that this method works extremely well for small problems, can work with some effort for a few non-trivial problems and totally breaks down for commercial software that requires multiple people on development staff and is used by users of different skills and personalities.

One way of thinking about this is that bad programmers do not care about quality and are only interested in paychecks. This gets us nowhere because there is no solution other than replacing those programmers. A better way of thinking is to assume that bad programmers do not “know” about quality and training can help. This is true for many programmers who can benefit from the knowledge of better tools and techniques. But it also doesn’t entirely really address the problem.

My observation has been that programmers who exhibit the trait of spending all their time in code is that they think they are doing work. They define work as churning out line after line of code. More lines of code, more functions, and more screens mean that they are doing work. Fixing bugs is also work. Another bug fixed means another piece of work accomplished.

To them, refactoring seems a strange thing to do. Why change the code when everything is working fine? Why not spend time working, i.e., getting some more functionality implemented? Especially since the refactoring usually consists of deleting code, i.e., reducing what was done before.

This may seem like sacrilege to good programmers, but there is a correspondence to a real world situation, namely, hoarding. Most people (including me) have a tendency to accumulate junk in our houses. We buy a book, read it and never touch it again, but it occupies a place on a bookshelf. A broken machine sits on a shelf in the kitchen. The basement or garage is full of memories from older days that we no longer care for. We spend little time clearing them out, but we spend extraordinary amounts of time and energy acquiring new things.

The culture at many software companies accentuate this behavior by the use of hard deadlines. For many programmers, it is a less risky proposition to release a low-quality product on time than it is to create a high-quality product that is two weeks late. Even when there are no apparent deadlines (such as an R&D projects), there are deadlines and you need to show something working, not just a design or prototype.

Now, for good programmers, lack of time is not an excuse for shoddy work. Most good programmers write good code and their lack of quality is usually at a higher level in terms of design that could have been better. For weaker programmers, they need an environment that can encourage them to work on improving their quality, in addition to mentoring, code reviews, pair programming and the like.

Finally, there will always be different levels of programmers (good, medium and bad) no matter what you do. It is not just about laziness or ignorance, but also related to innate skills, intelligence and aptitude for the job. Some people can visualize design concepts and create great systems. Others (who might be good in other areas) just don’t have the right engine for it. Some great programmers working in extremely complex code running system software can be very poor at user interface design and vice versa. Different people have different skills, and sometimes people are in the wrong profession.

This entry was posted in software development and tagged , . Bookmark the permalink.
반응형
반응형

Claims:

1. A method comprising:calibrating a magnetic sensor, the calibrating including:acquiring measurements from the magnetic sensor during a not pre-ordered movement;determining a plurality of sets of solutions for respective expected values of intensity of Earth's magnetic field, wherein each solution is defined by a plurality of parameters including at least one gain value for each detection axis of the magnetic sensor;determining a figure of merit, correlated to a calibration error, for each solution in the sets of solutions;selecting partial solutions in the sets of solutions, respectively, based on the figure of merit;defining a gain confidence interval; andselecting a calibration solution based on the figure of merit, from among the partial solutions having respective gain values all falling within the gain confidence interval.

2. The method according to claim 1, wherein acquiring the measurements comprises:receiving a new measurement from the magnetic sensor;defining distances between the new measurement and preceding measurements; anddeciding whether to store the new measurement based on the distances between the new measurement and the preceding measurements.

3. The method according to claim 2, wherein deciding whether to store the new measurement comprises storing the new measurement if the distances are all greater than a threshold distance and discarding the new measurement if at least one distance is smaller than the threshold distance.

4. The method according to claim 2, wherein the distance is defined byDIJ= {square root over ((MIX-MJX)2+(MIY-MJY)2+(MIZ-MJZ).- sup.2)}{square root over ((MIX-MJX)2+(MIY-MJY)2+(MIZ-MJZ).- sup.2)}{square root over ((MIX-MJX)2+(MIY-MJY)2+(MIZ-MJZ).- sup.2)}where MIX, MIY, MIZ are components of the new measurement corresponding to respective detection axes of the magnetic sensor and MJX, MJY, MJZ are components of the preceding measurements corresponding to respective detection axes of the magnetic sensor.

5. The method according to claim 2, wherein receiving the new measurement, defining the distances, and deciding whether to store the new measurement are repeated until a threshold number of measurements is stored.

6. The method according to claim 1, wherein determining the plurality of sets of solutions comprises:selecting an expected value;generating starting solutions, starting from the measurements acquired; updating a set of solutions; andselecting a further expected value.

7. The method according to claim 6, wherein generating the starting solutions comprises determining, for a plurality of solutions, respective first initial values of parameters around a unit value and respective second initial values of parameters around zero.

8. The method according to claim 6, wherein updating the set of solutions comprises:generating a new solution based on a combination of solutions of the set of solutions;determining a figure of merit of the new solution; anddeciding whether to include the new solution in the set of solutions based on the figure of merit of the new solution.

9. The method according to claim 8, wherein deciding whether to include the new solution comprises:determining a figure of merit of a least preferred solution in the set of solutions; andcomparing the figure of merit of the new solution with the figure of merit of the least preferred solution.

10. The method according to claim 9, wherein deciding whether to include the new solution further comprises including the new solution if the figure of merit of the new solution is in a pre-determined relationship with the figure of merit of the least preferred solution.

11. The method according to claim 10, wherein deciding whether to include the new solution further comprises:if the figure of merit of the new solution is not in the pre-determined relationship with the figure of merit of the least preferred solution, defining a replacement probability as a function of the figure of merit of the new solution and of the figure of merit of the least preferred solution;carrying out an extraction of a random variable;including the new solution based on a first outcome of the extraction of the random variable; andexcluding the new solution based on a second outcome of the extraction of the random variable.

12. The method according to claim 1, further comprising widening the gain confidence interval, if no partial solution has respective gain values all falling within the gain confidence interval.

13. The method according to claim 1, wherein determining the figure of merit comprises:applying a solution to the measurements for determining corrected measurements;determining errors between each corrected measurement and an expected value; andadding up the errors.

14. The method according to claim 1, wherein the parameters include at least one offset value for each detection axis of the magnetic sensor.

15. The method according to claim 1, further comprising:acquiring further measurements from the magnetic sensor;applying the calibration solution to the further measurements for determining further corrected measurements;determining a figure of merit of the calibration solution; anddeciding whether to perform safety measurements based on a comparison between the figure of merit of the calibration solution and a threshold figure of merit.

16. A device for calibrating a magnetic sensor, comprising:an acquisition module, configured to acquire measurements from a magnetic sensor during a non-pre-ordered movement;an optimization module configured to:determine a plurality of sets of solutions for respective expected values of intensity of Earth's magnetic field, wherein each solution is defined by a plurality of parameters including at least one gain value for each detection axis of the magnetic sensor;determine a figure of merit, correlated to a calibration error, for each solution in the sets of solutions; andselect partial solutions in the sets of solutions, respectively, based on the figure of merit; anda selection module, configured to:define a gain confidence interval; andselect a calibration solution based on the figure of merit, from among the partial solutions having respective gain values all falling within the gain confidence interval.

17. The device according to claim 16, wherein the acquisition module is further configured to:receive a new measurement from the magnetic sensor;define distances between the new measurement and preceding measurements; anddecide whether to store the new measurement based on the distances between the new measurement and the preceding measurements.

18. The device according to claim 16, wherein the optimization module is further configured to:select an expected value;generate starting solutions, starting from the measurements acquired;update a set of solutions; andselect a further expected value.

19. The device according to claim 18, wherein the optimization module is further configured to:generate a new solution based on a combination of solutions of the set of solutions;determine a figure of merit of the new solution; anddecide whether to include the new solution in the set of solutions based on the figure of merit of the new solution.

20. An electronic apparatus, comprising:a body;a magnetic sensor fixed to the body; anda device for calibrating the magnetic sensor, the device including:an acquisition module, configured to acquire measurements from the magnetic sensor during a non-pre-ordered movement;an optimization module configured to:determine a plurality of sets of solutions for respective expected values of intensity of Earth's magnetic field, wherein each solution is defined by a plurality of parameters including at least one gain value for each detection axis of the magnetic sensor;determine a figure of merit, correlated to a calibration error, for each solution in the sets of solutions; andselect partial solutions in the sets of solutions, respectively, based on the figure of merit; anda selection module, configured to:define a gain confidence interval; andselect a calibration solution based on the figure of merit, from among the partial solutions having respective gain values all falling within the gain confidence interval.

21. The electronic apparatus according to claim 20, further comprising:a control unit coupled to the magnetic sensor; andan interface coupled to the control unit.

22. A navigation system, comprising:a magnetic sensor configured to generate measurements indicative of a magnetic field; anda processing unit coupled to the magnetic sensor, the processing unit operable to calibrate the magnetic sensor by:acquiring the measurements from the magnetic sensor during movement of the magnetic sensor;determining a plurality of sets of solutions for respective expected values of intensity of Earth's magnetic field, wherein each solution is defined by a plurality of parameters including at least one gain value for each detection axis of the magnetic sensor;determining a figure of merit, correlated to a calibration error, for each solution in the sets of solutions;selecting partial solutions in the sets of solutions, respectively, based on the figure of merit;defining a gain confidence interval; andselecting a calibration solution based on the figure of merit, from among the partial solutions having respective gain values all falling within the gain confidence interval.

23. The navigation system according to claim 22, wherein the processing unit is further operable to:receive a new measurement from the magnetic sensor;define distances between the new measurement and preceding measurements; anddecide whether to store the new measurement based on the distances between the new measurement and the preceding measurements.

24. The navigation system according to claim 22, wherein the processing unit is further operable to:select an expected value;generate starting solutions, starting from the measurements acquired;update a set of solutions; andselect a further expected value.

25. The navigation system according to claim 24, wherein the processing unit is further operable to:generate a new solution based on a combination of solutions of the set of solutions;determine a figure of merit of the new solution; anddecide whether to include the new solution in the set of solutions based on the figure of merit of the new solution.

Read more: http://www.faqs.org/patents/app/20090070056#ixzz0x3135lOV




이제 마지막으로 개발하면 되는 여러 참조 자료들 중에 선정된 지자기센서 소프트웨어 알고리즘 프로젝트 자료.

8개월동안 기나긴 기간동안 연구&개발을 해왔던 프로젝트를 종지부를 지을 수 있는 계기가 되길-

처음에는 무엇을 할지 막막했는데, 이제는 익숙하고, 내가 다룰 수 있는 기술이 되어버렸다.

자~ 정상이 저기 앞에 보이기 시작 했으니, 조금만 더 노력하고, 최선을 다하자!

2010/08/19 16:07 2010/08/19 16:07


 

반응형

+ Recent posts