Sunday, November 1, 2015

custom sizeof implementation

#include <stdio.h>

#define my_sizeof(type) (((type *)0)+1)

int main()
{
    printf("size of int = %d\n", sizeof(int));
    printf("My size of int = %d\n", my_sizeof(int));
    printf("My size of char = %d\n", my_sizeof(char));
    printf("My size of float = %d\n", my_sizeof(float));
    printf("My size of double = %d\n", my_sizeof(double));
    return 0;
}


Result:
   size of int = 4
   My size of int = 4
   My size of char = 1
   My size of float = 4
   My size of double = 8

BeagleBoard notes


============================================
How to load files(rd-ext2.bin & uImage) from mmc card and boot Linux?

In u-boot:
mmc rescan
fatload mmc 0:1 81600000 rd-ext2.bin

setenv bootargs mem=88M ip=172.16.9.111 console=ttyO2,19200n8 root=/dev/ram0 rw initrd=0x81600000,16M ramdisk_size=16384

fatload mmc 0:1 80000000 uImage
============================================


----------------------------------------
make uImage LOADADDR=0x80008000
make CONFIG_PREFIX=/home/neo/tgt install
make omap2plus_defconfig

-------------------------------------------
git status
  201  arm-linux-gnueabi-
  202  export ARCH=arm
  203  export CROSS_COMPILE=arm-linux-gnueabi-
  204  make uImage
  205  ls arch/arm/configs/ | grep omap
  206  make omap2plus_defconfig
  207  make uImage
  208  rm drivers/video/built-in.o
  209  rm drivers/video/.built-in.o.cmd
  210  make uImage
  211  rm drivers/video/console/built-in.o
  212  make uImage
  213  make distclean
  214  make omap2plus_defconfig
  215  make uImage
  216  make uImage LOADADDR=0x80008000
  217  cp arch/arm/boot/uImage /media/neo/boot/