Linux2021. 7. 9. 10:42

ldd나 getconf 등으로 얻을수도 있지만, 임베디드에서는 해당 실행 파일을 넣지 않는 경우도 있어서 멘붕

[링크 : https://ososoi.tistory.com/79]

[링크 : https://www.linuxquestions.org/questions/linux-software-2/how-to-check-glibc-version-263103/]

 

라이브러리 버전을 보면 보이긴 한데.. 확실하게 확인하고 싶으니까 좀 더 찾아보니

# ls -al /lib/libc*
-rwxr-xr-x    1 root     root       1230544 Jan  1  1970 /lib/libc-2.26.so
lrwxrwxrwx    1 root     root            12 Jan  1  1970 /lib/libc.so.6 -> libc-2.26.so

 

so 인데 실행이 되는게 신기하긴 하네..

# /lib/libc.so.6
GNU C Library (Buildroot) stable release version 2.26, by Roland McGrath et al.
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 6.4.0.
Available extensions:
        crypt add-on version 2.1 by Michael Glad and others
        GNU Libidn by Simon Josefsson
        Native POSIX Threads Library by Ulrich Drepper et al
        BIND-8.2.3-T5B
libc ABIs: UNIQUE
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.

 

[링크 : https://dev.to/0xbf/how-to-get-glibc-version-c-lang-26he]

 

Posted by 구차니
Programming/C Win32 MFC2021. 7. 9. 10:35

 

NOTES
   Glibc notes
       The GNU C library allows the following extensions for the string specified in mode:

       c (since glibc 2.3.3)
              Do not make the open operation, or subsequent read and write operations, thread cancellation points.  This flag is ignored for fdopen().

       e (since glibc 2.7)
              Open the file with the O_CLOEXEC flag.  See open(2) for more information.  This flag is ignored for fdopen().

       m (since glibc 2.3)
              Attempt to access the file using mmap(2), rather than I/O system calls (read(2), write(2)).  Currently, use of mmap(2) is attempted only for a file opened for reading.

       x      Open the file exclusively (like the O_EXCL flag of open(2)).  If the file already exists, fopen() fails, and sets errno to EEXIST.  This flag is ignored for fdopen().

[링크 : https://stackoverflow.com/questions/33312900/how-to-forbid-multiple-fopen-of-same-file]

[링크 : https://stackoverflow.com/questions/16806998/is-fopen-a-thread-safe-function-in-linux]

'Programming > C Win32 MFC' 카테고리의 다른 글

MSB / LSB 변환  (0) 2022.08.29
kore - c restful api server  (0) 2022.07.07
vs2019 sdi , mdi 프로젝트 생성하기  (0) 2021.07.08
vkey win32 / linux  (0) 2021.04.30
strptime  (0) 2021.02.17
Posted by 구차니
Programming/c# & winform2021. 7. 8. 13:55

말이 애매한데..

창을 키우면 자동으로 내부 콤포넌트들이 자동으로 키워져 비율에 맞게 작동하는

UI를 제작하고 싶어서 찾아보는 중.

 

Dock을 Fill로 해주면 되는 건가?

[링크 : https://docs.microsoft.com/en-us/dotnet/desktop/winforms/controls/layout?view=netdesktop-5.0]

 

[링크 : https://cwkcw.tistory.com/166]

 

+

paint 함수를 재정의 해서 계산후 적용하는 것도 방법이군..

[링크 : https://stackoverflow.com/questions/40269285/c-sharp-changing-the-size-of-a-button-text]

'Programming > c# & winform' 카테고리의 다른 글

winform IsMdiContainer  (0) 2021.07.12
DataGridView  (0) 2021.07.12
winform MDI  (0) 2021.07.08
winform 첨자(superscript/subscript)  (0) 2021.07.07
nuget RibbonWinForms  (0) 2021.07.06
Posted by 구차니
Programming/c# & winform2021. 7. 8. 13:37

MFC 말고 winform으로는 안되나 찾아보는데 IsMdiContainer 라는게 있대서 찾아보니 있긴하네?

아무튼.. 그렇다면 창 스타일로 지정되고

dialog based로 생성되어도 그 안에 MDI로 구성을 하는 스타일로 격하(?)되었다는 건가?

 

[링크 : https://docs.microsoft.com/.../how-to-create-mdi-parent-forms?view=netframeworkdesktop-4.8]

[링크 : https://docs.microsoft.com/.../how-to-create-mdi-child-forms?view=netframeworkdesktop-4.8]

[링크 : https://docs.microsoft.com/.../multiple-document-interface-mdi-applications?view=netframeworkdesktop-4.8]

 

'Programming > c# & winform' 카테고리의 다른 글

DataGridView  (0) 2021.07.12
winform 자동으로 UI 늘리기  (0) 2021.07.08
winform 첨자(superscript/subscript)  (0) 2021.07.07
nuget RibbonWinForms  (0) 2021.07.06
ansi escape code  (0) 2021.05.24
Posted by 구차니
Programming/C Win32 MFC2021. 7. 8. 11:39

그냥해봤는데 내꺼에 설치된 패키지 중에는 SDI / MDI를 지원하는 패키지가 없었는지

부랴부랴 검색해서 추가중

[링크 : https://yyman.tistory.com/1357]

 

 

와와 이제 뜬다!!!!

 

흐으으으으음?! 컴파일러 뿐만 아니라 MFC 라이브러리가 별도로 필요한가?

이 프로젝트에는 MFC 라이브러리가 필요합니다. 사용되는 모든 도구 세트 및 아키텍처의 경우 Visual Studio 설치 관리자(개별 구성 요소 탭)에서 설치하세요.

[링크 : https://docs.microsoft.com/ko-kr/visualstudio/msbuild/errors/msb8041?view=vs-2019]

 

MFC로 검색해서 두개의 구성요소를 설치해야 한다.

  • 스펙터 완화를 지원하는 최신 v000 빌드 도구용 C++ MFC(x86 및 x64)
  • 최신 v000 빌드 도구용 C++ MFC(x86 및 x64)

 

스펙터는 설치안하고 최신 빌드 도구용만 까니 라이브러리 없다고 실행안되는거 보면.. 스펙터는 핑계고(?)

번역상에 문제로 스펙터 완화를 지원하는... 건 실제로는 runtime library 아닌가 의심된다.

 

아무튼 프로젝트 생성해서 빌드만 겨우 했네 휴..

근데 SDI로 작성하긴 했는데 왜이렇게 데모 프로젝트가 현란해? 무슨 Visual Studio 인 줄 ㄷㄷ

[링크 : https://yyman.tistory.com/1367]

'Programming > C Win32 MFC' 카테고리의 다른 글

kore - c restful api server  (0) 2022.07.07
fopen exclusivly  (0) 2021.07.09
vkey win32 / linux  (0) 2021.04.30
strptime  (0) 2021.02.17
while(-1) 이 될까?  (0) 2019.05.24
Posted by 구차니
프로그램 사용/gcc2021. 7. 8. 10:40

귀찮으니 날로먹는 코딩으로 테스트

$ cat 1.c
#include <stdio.h>

void main()
{
        unsigned char a = 0xFF;
        char b =a;
        short c = a;
        short d = (char)a;
        short e = (int)a;

        int f = a;
        int g = (int)a;
        int h = (int)(char)a;

        printf("a %d\n",a);
        printf("a %d\n",(int)a);
        printf("a %d\n",(char)a);
        printf("b %d\n",b);
        printf("c %d\n",c);
        printf("d %d\n",d);
        printf("e %d\n",e);
        printf("f %d\n",f);
        printf("g %d\n",g);
        printf("h %d\n",h);
}

 

컴파일러 버전과 아키텍쳐, 그리고 결과인데... 머냐..?!?!

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
$ arm-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabihf/7/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-multiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-multilib --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf- --includedir=/usr/arm-linux-gnueabihf/include
Thread model: posix
gcc version 7.5.0 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)
$ ./1
a 255
a 255
a -1
b -1
c 255
d -1
e 255
f 255
g 255
h -1
# /mnt/1
a 255
a 255
a 255
b 255
c 255
d 255
e 255
f 255
g 255

 

라즈베리 파이 4에서 시도. arm 아키텍쳐용 컴파일러의 특성인가?

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/8/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-6' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --disable-libphobos --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
gcc version 8.3.0 (Debian 8.3.0-6)
$ ./1
a 255
a 255
a 255
b 255
c 255
d 255
e 255
f 255
g 255
h 255

 

+

두개중에 하나만 주면 되는진 모르겠지만, 둘 다 주거나 -fsigned-char 만 주어도 결과가 -1로 나오긴 한다.

원문으로 보니 --signed-chars는 RVCT 컴파일러를 위한 옵션인 듯.

The ANSI C standard specifies a range for both signed (at least -127 to +127) and unsigned (at least 0 to 255) chars. Simple chars are not specifically defined and it is compiler dependent whether they are signed or unsigned. Although the ARM architecture has the LDRSB instruction, that loads a signed byte into a 32-bit register with sign extension, the earliest versions of the architecture did not. It made sense at the time for the compiler to treat simple chars as unsigned, whereas on the x86 simple chars are, by default, treated as signed.
One workaround for users of GCC is to use the -fsigned-char command line switch or --signed-chars for RVCT, that forces all chars to become signed, but a better practice is to write portable code by declaring char variables appropriately. Unsigned char must be used for accessing memory as a block of bytes or for small unsigned integers. Signed char must be used for small signed integers and simple char must be used only for ASCII characters and strings. In fact, on an ARM core, it is usually better to use ints rather than chars, even for small values, for performance reasons. You can read more on this in Optimizing Code to Run on ARM Processors.

[링크 : https://developer.arm.com/.../Miscellaneous-C-porting-issues/unsigned-char-and-signed-char]

 

LDRSB (Thumb*) - Load Register Signed Byte

[링크 : http://qcd.phys.cmu.edu/QCDcluster/intel/vtune/reference/LDRSB_(Thumb).htm]

 

LDRB - Load Register Byte

[링크 : http://qcd.phys.cmu.edu/QCDcluster/intel/vtune/reference/INST_LDRB.htm]

 

char -> signed char: -fsigned-char == -fno-unsigned-char
char -> unsigned char: -funsigned-char == -fno-signed-char

[링크 : https://jooojub.github.io/gcc-options-fsigned-char/]

 

-fsigned-char
Let the type char be signed, like signed char.
Note that this is equivalent to -fno-unsigned-char, which is the negative form of -funsigned-char. Likewise, the option -fno-signed-char is equivalent to -funsigned-char.

-funsigned-char
Let the type char be unsigned, like unsigned char.
Each kind of machine has a default for what char should be. It is either like unsigned char by default or like signed char by default.
Ideally, a portable program should always use signed char or unsigned char when it depends on the signedness of an object. But many programs have been written to use plain char and expect it to be signed, or expect it to be unsigned, depending on the machines they were written for. This option, and its inverse, let you make such a program work with the opposite default.
The type char is always a distinct type from each of signed char or unsigned char, even though its behavior is always just like one of those two.

[링크 : https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html]

 

+

2021.07.09

으잉? singed char로 하면 되긴 한다. char가 signed 아니었어?!

'프로그램 사용 > gcc' 카테고리의 다른 글

static link  (0) 2022.02.07
구조체 타입과 변수명은 구분된다?  (0) 2021.11.18
gcc vectorized loop  (0) 2021.06.30
gcc unsigned to signed cast  (0) 2021.06.22
gcc %p (nil)  (0) 2021.05.07
Posted by 구차니
embeded/raspberry pi2021. 7. 7. 19:07

23페이지에 나오는 내용(2021.07.07 기준)

예전에 stellarisware(ti/cortex-m3) 쓸 때 이런 컨셉이 있었던 것 같은데, 플래시 용량 줄이는 것 외에는 큰 메리트가 있는지

몰랐는데 아키텍쳐의 차이인진 모르겠지만 벤치마크를 보니 꽤나 혹한다.

2.7.2. Floating-point Support
The SDK provides a highly optimized single and double precision floating point implementation. In addition to being fast, many of the functions are actually implemented using support provided in the RP2040 bootrom. This means the interface from your code to the ROM floating point library has very minimal impact on your program size, certainly using dramatically less flash storage than including the standard floating point routines shipped with your compiler. The physical ROM storage on RP2040 has single-cycle access (with a dedicated arbiter on the RP2040 busfabric), and accessing code stored here does not put pressure on the flash cache or take up space in memory, so not only are the routines fast, the rest of your code will run faster due them being resident in ROM. This implementation is used by default as it is the best choice in the majority of cases, however it is also possible to switch to using the regular compiler soft floating point support.

 

bootrom에 있는 함수들을 이용하면 더욱 빠르게 부동소수점 연산이 가능하다는데

나누기 연산의 경우 GCC 라이브러리에 비해서 586% 감소한다고

아래 두개는 먼가 미친듯한 성능 차이가 있어서 끌어 와봄.

Function        ROM/SDK (μs) GCC 9 (μs) Performance Ratio
__aeabi_fdiv 74.7                  437.5          586%
__aeabi_f2lz 63.1                 1240.5        1966%
__aeabi_f2ulz 46.1               1157            2510%

 

27페이지에 나오는 내용인데(2021.07.07 기준)

GCC 라이브러리를 사용하여 계산하는 것과

SDK 라이브러리(RP2040 hardware divider)를 이용하는 것의 속도 차이가 어마어마하다고 한다.

일단 하드웨어 divider를 사용하니 당연한걸지도 모르지만 고정속도라..

[링크 : https://datasheets.raspberrypi.org/pico/raspberry-pi-pico-c-sdk.pdf]

[링크 : https://github.com/raspberrypi/pico-sdk]

[링크 : https://webnautes.tistory.com/1475]

 

+

2021.07.08

라즈베리 파이 pico의 bootrom 소스 리파지터리.

아무튼.. 위의 내용은 어셈블러로 함수를 작성해 놓은 듯.

[링크 : https://github.com/raspberrypi/pico-bootrom/blob/master/bootrom/mufplib-double.S]

[링크 : https://github.com/raspberrypi/pico-bootrom/blob/master/bootrom/mufplib.S]

'embeded > raspberry pi' 카테고리의 다른 글

조향장치 완성  (0) 2021.07.24
rpi 2b pxe  (0) 2021.07.12
rpi pico USB 키보드 코드 수정  (0) 2021.07.01
aarch, armv8 asimd build (neon)  (0) 2021.06.30
rpi 4b 32bit vs 64bit?  (0) 2021.06.30
Posted by 구차니
embeded/esp322021. 7. 7. 16:10

esp32-cam의 CameraWebServer가 freeRTOS 기반인줄 알았는데

코드를 분석해봐도 안나와서 검색해보니

별도의 esp32-idf(Espressif IoT Development Framework) 라고 개발되고 관리되는 듯.

[링크 : https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/]

 

freeRTOS 공부할겸 한번 해봐야겠네

[링크 : https://slowbootkernelhacks.blogspot.com/2020/12/esp32-freertos.html]

[링크 : https://blog.naver.com/serimo/221560776476]

 

+

[링크 : https://chocoball.tistory.com/entry/Hardware-ESP32-Dual-core]

'embeded > esp32' 카테고리의 다른 글

회사에 남는 부품으로 쓱쓱  (0) 2021.07.14
AMS1117 LDO 고장?  (0) 2021.07.13
esp32cam setting  (0) 2021.07.06
esp32cam webservercam rtsp?  (0) 2021.06.28
LDO 발열?  (0) 2021.06.25
Posted by 구차니
Programming/c# & winform2021. 7. 7. 10:32

charmap(문자표)에서 보면

왜 순서대로 0 1 2 3 4 5 6 7 8 9 가 있는게 아닌거냐!!

0~9 순서로 유니코드 정렬하면 다음과 같네

{0x2070, 0x00B9, 0x00B2, 0x00B3, 0x2074, 0x2075, 0x2076, 0x2077, 0x2078, 0x2079}

 

Arial에서는 subscript로 검색하니 숫자는 안나오지만 굴림으로는

2314n에 대한 subscript / superscript가 검색된다. 폰트별로 다르다니.

 

 

 

[링크 : https://www.python2.net/questions-257019.htm] 특수문자 사용

[링크 : https://stackoverflow.com/questions/19682459/superscript-label-or-form-name

 

[링크 : http://csharphelper.com/blog/2016/06/display-subscripts-superscripts-richtextbox-c/]

[링크 : https://icodebroker.tistory.com/5740] richedit offset 조정

'Programming > c# & winform' 카테고리의 다른 글

winform 자동으로 UI 늘리기  (0) 2021.07.08
winform MDI  (0) 2021.07.08
nuget RibbonWinForms  (0) 2021.07.06
ansi escape code  (0) 2021.05.24
c# richtextbox 글씨 색상 입히기  (0) 2021.05.24
Posted by 구차니

임기내로 민주당이 여성부 없애면 떡상 가능한거 아닌가?!

 

[링크 : https://news.v.daum.net/v/20210707080003654]

Posted by 구차니